[Tutor] Issue w/ string input "for", "not", "while", "else" etc.

Rafael Knuth rafael.knuth at gmail.com
Tue Nov 26 17:15:31 CET 2013


Hej there,

simple issue I couldn't find a solution for:

YourName = input(str("What is your name?"))
print("Hello", YourName)

When executing the program, in case the user input is "for", "not",
"True", "while" Python interprets that as a command and changes the
input's color to the corresponding command. The program runs without
any further issues, but I was wondering: How can I make sure Python
"understands" that the user input is nothing else but a string? I
tried to fix that by changing input("What is your name?") to
input(str("What is your name?)) but that didn't work.

Thanks in advance,

Raf


More information about the Tutor mailing list