Professional Documents
Culture Documents
BCSE308P
COMPUTER NETWORKS
Code:
def calculate_address_range(ip_address):
# Split the IP address into octets
octets = ip_address.split('.')
Output:
2.Write a C/C++/Python/Java program to read a
classless address in a block as input. (like
x.y.z.t/n). Display the number of addresses in the
block, the first address, and the last address.
Code:
import ipaddress
def calculate_address_range(ip_block):
# Split the IP block into address and prefix length
ip_address, prefix_length = ip_block.split('/')
Output: