Note: This question is about a problem with repl.it, not a general problem.
Note: You might consider this as a duplicate, but in fact it isn't.
These do not suit my problem:
- Python unexpected EOF while parsing : syntax error
- Python unexpected EOF while parsing
- Unexpected EOF while parsing in python
- Python unexpected EOF while parsing (python2.7)
(Taken from alerady answered questions list, duplicates excluded for compactness)
I've got a problem with for loops in Python (repl.it Python 2 and Python 3 interpreters) in that one-line for loops without a trailing newline raise SyntaxError
.
for i in (1,2,3,4,): print i+i+i
Traceback (most recent call last): File "python", line 1 for i in (1,2,3,4,): print i+i+i ^ SyntaxError: unexpected EOF while parsing
for i in (1,2,3,4,): print i+i+i
# Trailing newline
3 6 9 12
Another question: How to display a trailing newline , trailing space or unprintable character in SE (without using <pre>)?