Question: python. please give a full code with the host and which will return ip address of the host name following the code on the picture
2 The following code has the following format: 3 # are ordinary comments 4 He describe coment lines that you should replace with Python code that actually does the thing described in that comment. 5 6 For example: 7 8 a typical hello-world program 9 e print out the string "hello world" 10 11 You would then take the 49 and replace it so that you would then have 12 13 a typical hello-world program 14 print("hello world") 15 16 17 import socket 18 19 _name__ 20 21 #here's where we set the hostname that we want to resolve 22 you may hardcode it or read from command line or standard input 23 * hostname = 24 25 # return IP address of hostname 26 try: 27 #here's where we get the address based on the hostname 28 # addr = call to the function that resolves the hostname into an address print("Successfully resolved. The IP address of (> 1 ().format(hostname, addr)) except socket.gaterror as err! print ("Can't find hostname: ", orr) except socket. timeout as Err: print ("Can't resolve this hostname due to connection timeout: err) 29 30 31 32 33
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
