Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python please give me the full code including host name and return ip address of host name. 2 3 4 5 6 7 8 9
python
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 The following code has the following format: # are ordinary comments de describe coment lines that you should replacu with Python code that actually does the thing described in that comment. For example: # a typical hello-world program me print out the string "hello world" You would then take the 49 and replace it so that you would then have . a typical hello-world program print("hello world 17 import socket 18 19 ir _name__ 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 # return IP address of hostname try: # here's where we get the address based on the hostname * addr = call to the function that resolves the hostname into an address print('Successfully resolved. The IP address of 1s ().format(hostname, addr)) except socket.gaterror as ert: print ("Can't find hostname: "err) except socket. timeout as err: print ("Can't resolve this hostname due to connection timeout: err) 25 26 28 29 30 31 32 33 34 please give me the full code including host name and return ip address of host name.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started