Someone help me to change my python code to Pseudocode | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Someone help me to change my python code to Pseudocode

# Build a list of host name from socket import gethostbyname hostList = [] host = input("Please enter a host name or press Enter to quit: ") while host != '': if host != '': hostList.append(host) host = input("Please enter a host name or press Enter to quit: ") if len(hostList) == 0: print("You haven't entered any host names") else: count = 0 for u in hostList: # list the host names, with an associated index print(str(count) + ": "+ hostList[count]) count +=1 try: data = input("Please enter the index number of desired host name or press Enter to quit:") while data != '': dataNum =int(data) if int(data) <0 or int(data) >= len(hostList): print("invaild index range") break else: ipAdd = gethostbyname(hostList[dataNum]) print("The IP address of " + hostList[dataNum] + " is " + str(ipAdd)) data = input("Please enter the index number of the desired host name or Press Enter to quit: ") except ValueError: print("Invalid Index number") except: print("invalid website") print("Goodbye")

27th Oct 2022, 2:26 AM
tiwnoo
1 Answer
+ 3
Python is already psudocode :) and psudocode is used to write algorithm not a socket program
27th Oct 2022, 5:05 AM
Prashanth Kumar
Prashanth Kumar - avatar