我有Python代码,要求用户输入数字,然后程序将其平方。我希望你们向我展示您的设计。我之所以向你们求助,是因为我想进一步了解设计。请
非常感谢您的帮助
print ("Enter 'exit' when you're done.\n")
while True:
data = input("Enter your number: ")
if data == "exit":
break
i = int(data)
print (i, "The result is: " , i * i, "\n")
print ("Thank you-Bye !!: ")
示例执行:
Enter 'exit' when you're done.
Enter your number: 10
10 The result is: 100
Enter your number: 23
23 The result is: 529
Enter your number: exit
Thank you-Bye !!: