while True: line=input("> ") if line=="Done": break print(line) print("done")
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.
See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (
</>) will also add backticks around text.
Note: Backticks are not single quotes.
What is going on? What are you trying to do? What part do you need help with? What errors are you experiencing? What else have you tried while attempting to solve the problem?
Traceback (most recent call last):
File “loop1.py”, line 2, in
File “”, line 1, in
NameError: name ‘hello’ is not defined
Are you, by any chance, using Python3 syntax in a Python2 environment?