Reputation: 11
How do I get user input with micro python? Whenever I try using
input()
I get an error saying it is not a valid command. How do i fix this?
Upvotes: 1
Views: 4015
Reputation: 174
Use sys.stdin.readline()
import sys
print("What is the Answer to the Ultimate Question of Life, the Universe, and Everything?")
answer = sys.stdin.readline()
if answer == "42\n":
print("correct!")
else:
print("incorrect!");
Upvotes: 1