Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/341.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
I';我正在尝试用python循环一个基本的用户输入脚本 我在一个基本的种族选择输入中间。 userInput = input print ('I choose a(n)', userInput) if userInput is ('Human'): input ('I like Humans, help that I am one') if userInput is ('Orc'): print ('Hate orcs, I dont like green :(') if userInput is ('Android'): print ('Robots are cool, so by theory Androids are too') else: print ('Try Again')_Python_Python 3.x_Input_User Input - Fatal编程技术网

I';我正在尝试用python循环一个基本的用户输入脚本 我在一个基本的种族选择输入中间。 userInput = input print ('I choose a(n)', userInput) if userInput is ('Human'): input ('I like Humans, help that I am one') if userInput is ('Orc'): print ('Hate orcs, I dont like green :(') if userInput is ('Android'): print ('Robots are cool, so by theory Androids are too') else: print ('Try Again')

I';我正在尝试用python循环一个基本的用户输入脚本 我在一个基本的种族选择输入中间。 userInput = input print ('I choose a(n)', userInput) if userInput is ('Human'): input ('I like Humans, help that I am one') if userInput is ('Orc'): print ('Hate orcs, I dont like green :(') if userInput is ('Android'): print ('Robots are cool, so by theory Androids are too') else: print ('Try Again'),python,python-3.x,input,user-input,Python,Python 3.x,Input,User Input,但是输出很奇怪 I choose a(n) <built-in function input> Try Again 我选择一个(n) 再试一次 看到脚本的问题了吗?我认为它不会等待输入,因为没有输入,它只是说“再试一次”,但我不完全确定如何解决这个问题。 这可能是一个简单的解决方法,但我真的不知道:(试试看 userInput = input() 也就是说,input()是一个函数调用 userInput = input() 也就是说,input()是一个函数调用@Samu

但是输出很奇怪

I choose a(n) <built-in function input>

Try Again
我选择一个(n)
再试一次
看到脚本的问题了吗?我认为它不会等待输入,因为没有输入,它只是说“再试一次”,但我不完全确定如何解决这个问题。 这可能是一个简单的解决方法,但我真的不知道:(

试试看

userInput = input()
也就是说,
input()
是一个函数调用

userInput = input()

也就是说,
input()
是一个函数调用

@Samuel Quansah如果我的答案解决了您的问题,请接受它。@Samuel Quansah如果我的答案解决了您的问题,请接受它。