我的任务是编写一个脚本,向用户询问一个具有固定数量的可能答案的问题。这是我到目前为止所知道的:
print("who's your favorite actor: Tom Cruise, Nicholas Cage, or Jonah Hill?")每次运行时,我都会陷入while循环,不断被问到“不,说真的,你最喜欢的演员是谁?”我使用了user_input.lower(),因为输入必
我试图添加两个数字,即使它们包含"-“或”。“,但是我的if命令是错误的,下面是代码: print "\nAddition" print "What is your first numberadd()当我输入一个像"-sf“这样的非数字时,它返回错误:
ValueError: could not convert string to floa