Created
October 15, 2024 07:39
-
-
Save kaubu/3bab9b0515506bec1aa8a35fa597ede6 to your computer and use it in GitHub Desktop.
Given a prefix notation, calculate the possible number of IP addresses in a subnet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calc_assignable(prefix): | |
import math | |
print(f"{int(math.pow(2, 32 - prefix) - 2):,}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment