Hi I'm new to python programming and can't find this help anywhere
I have a user input value that I want to search for in a specified list exp :
option=input("option: ")
iplist=['192.168.1.1', '192.168.1.2', '192.168.1.254']
while option <= "3":
#this is wrong. Help!
nub = iplist[option]
subprocess.call(["ping", nub])
I want The Option Of The User To Be The Number Inside The List For This program the output should be :
Option : 0
Pinging 192.168.1.1 with 32 bytes of data:
Reply from 192.168.1.1: bytes=32 time=2ms TTL=64
Reply from 192.168.1.1: bytes=32 time=2ms TTL=64
Reply from 192.168.1.1: bytes=32 time=2ms TTL=64
Reply from 192.168.1.1: bytes=32 time=2ms TTL=64
Ping statistics for 192.168.1.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 2ms, Maximum = 2ms, Average = 2ms