@@ -0,0 +1,2005 @@
+#!/usr/bin/env python%0A%0A'''%0A%0ADisclaimer - This is a solution to the below problem given the content we have discussed in class#1 and class#2.  It is not necessarily the best solution to the problem.  In other words, I only use things we have covered up to this point in the class.%0A%0APython for Network Engineers%0Ahttps://pynet.twb-tech.com%0ALearning Python%0AClass#2%0A%0AI. Create a script that does the following%0A   A. Prompts the user to input an IP network.%0A       Notes: %0A       1. For simplicity the network is always assumed to be a /24 network%0A       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%0A   B. Regardless of which of the three formats is used, store this IP network as a list in the following format %5B'10', '88', '17', '0'%5D i.e. a list with four octets (all strings), the last octet is always zero (a string).%0A       Hint: There is a way you can accomplish this using a list slice.%0A       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).%0A%0A%3E%3E%3E%3E CODE %3C%3C%3C%3C%0Aif len(octets) == 3:%0A    octets.append('0')%0Aelif len(octets) == 4:%0A    octets%5B3%5D = '0'%0A%3E%3E%3E%3E END %3C%3C%3C%3C%0A%0A   C. Print the IP network out to the screen.%0A   D. Print a table that looks like the following (columns 20 characters in width):%0A%0A      NETWORK_NUMBER   FIRST_OCTET_BINARY      FIRST_OCTET_HEX%0A      88.19.107.0      0b1011000               0x58%0A%0A'''%0A%0Aip_network = raw_input(%22%5Cn%5CnEnter a network number: %22)%0A%0Aoctets = ip_network.split(%22.%22)%0Aoctets = octets%5B:3%5D%0Aoctets.append('0')%0A%0Anetwork_number = %22.%22.join(octets)%0Aprint %22%5CnYour network number is: %25s%22 %25 network_number%0A%0Afirst_octet_bin = bin(int(octets%5B0%5D))%0Afirst_octet_hex = hex(int(octets%5B0%5D))%0A%0Aprint %22%5Cn%5Cn%22%0Aprint %22%2520s %2520s %2520s%22 %25 (%22NETWORK_NUMBER%22, %22FIRST_OCTET_BINARY%22, %22FIRST_OCTET_HEX%22)%0Aprint %22%2520s %2520s %2520s%22 %25 (network_number, first_octet_bin, first_octet_hex)%0Aprint %22%5Cn%5Cn%22%0A%0A

Add exercise1 for class#2