two python based programs

two python based programs:1) I need a program that reads four integer values corresponding to an IP address "a1.a2.a3.a4" (IPv4), and determines whether the values form a valid IP address, the class of this IP address, and whether or not the valuescorrespond to a reserved IP address space.2) The input IP address components a1, a2, a3 and a4 form a valid IP address if a1 is between 1 and 255, and the rest of the values are between 0 and 255, both included.NOTE: Once your program determines that the input IP address is invalid, it can terminate by using the command sys.exit()
You will need to also import the sys module at the beginning of your program.NOTE: For full credit in this part of the problem, use a single if/else statement with a Boolean expression. Alternate solutions that work properly are worth 70%.How To Determine The Class Of An IP Address? (25 points)
The class of an IP address depends on the range a1 falls in:Class Range
-----------------
"A" 1 - 127
"B" 128 - 191
"C" 192 - 223
"D" 224 - 239
"E" 240 - 255
-----------------
NOTE: for full credit in this part of the problem, use only a multi-way conditional statement. Alternate solutions that work properly are worth 70%.How To Determine If An IP Address Is Private? (50 points)
An IP address is private if the address a1.a2.a3.a4 falls in one of the address ranges below:Private IP Address
-------------------------------
10.0.0.0 - 10.255.255.255
127.0.0.0 - 127.255.255.255
172.16.0.0 - 172.31.255.255
192.88.99.0 - 192.88.99.255
192.168.0.0 - 192.168.255.255
-------------------------------
NOTE: for full credit in this part of the problem, use a multi-way conditional statement with Boolean expressions. Alternate solutions that work properly are worth 70%
Powered by