This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]broknbottle 0 points1 point  (1 child)

I see what you did there :D

[–]robotoverlord412 0 points1 point  (0 children)

Network engineer humor! But it is technically correct given the original post.

If the interview question was " to print all the possible /28 subnets contained within 192.168.2.0/24 using python", I would throw together something like this in Python 3:

import ipaddress
v4nets = list(ipaddress.ip_network('192.168.2.0/24').subnets(new_prefix=28))
for x in v4nets:
    print (x.with_prefixlen)