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}")