1## importing socket module
2import socket
3## getting the hostname by socket.gethostname() method
4hostname = socket.gethostname()
5## getting the IP address using socket.gethostbyname() method
6ip_address = socket.gethostbyname(hostname)
7## printing the hostname and ip_address
8print(f"Hostname: {hostname}")
9print(f"IP Address: {ip_address}")
11. Import the socket module.
22. Get the hostname using the socket.gethostname() method and store it in a variable.
33. Find the IP address by passing the hostname as an argument to the
4socket.gethostbyname() method and store it in a variable.
54. Print the IP address.