Python – Kirk Byers Course Week 2 Part 1
This post will describe the exercises and solutions for week two of Kirk Byers Python for Network Engineers.
This is the first exercise:
I. Create a script that does the following A. Prompts the user to input an IP network. Notes: 1. For simplicity the network is always assumed to be a /24 network 2. The network can be entered in using one of the following three formats 10.88.17.0, 10.88.17., or 10.88.17 B. Regardless of which of the three formats is used, store this IP network as a list in the following format ['10', '88', '17', '0'] i.e. a list with four octets (all strings), the last octet is always zero (a string). Hint: There is a way you can accomplish this using a list slice. Hint2: If you can't solve this question with a list slice, then try using the below if statement (note, we haven't discussed if/else conditionals yet; we will talk about them in the next class). >>>> CODE <<<< if len(octets) == 3: octets.append('0') elif len(octets) == 4: octets[3] = '0' >>>> END <<<< C. Print the IP network out to the screen. D. Print a Continue reading