I have a simple code:
#!/usr/bin/env python
import sys
print (sys.version)
list = ["cat", "dog", "horse", "duck"]
for animal in list:
if animal == "cat" or animal == "duck":
print animal
input("Press Enter to continue ...")
The output of print (sys.version)
is
2.7.11 (default, Dec 19 2016, 17:44:19)
[GCC 5.3.0]
However, the program crashes at line input("Press Enter to continue ...")
upon pressing Enter , indicating an error
SyntaxError: unexpected EOF while parsing
Why would this happen?
This question is related to How do I make python to wait for a pressed key