+ 2

Syntax error in code from Python Docs

This code is coped form documentation: for x in range(0, 3): print "We're on time %d" % (x) ERROR: File "..\Playground\", line 2 print "We're on time %d" % (x) ^ SyntaxError: invalid syntax https://code.sololearn.com/c62gkW8nD4m3/#py documentation: https://wiki.python.org/moin/ForLoop it is literaly the same why it dosnt work ??

20th Dec 2018, 8:29 PM
Paweu
Paweu - avatar
3 Réponses
+ 3
This code has been written in python 2 but sololearn only support python 3. Print statements should be written inside () For example: print("This is python3") print "This is python2"
20th Dec 2018, 8:51 PM
Julian
Julian - avatar
+ 2
Paweu No problem!!
20th Dec 2018, 8:58 PM
Julian
Julian - avatar
+ 1
Thanks!
20th Dec 2018, 8:57 PM
Paweu
Paweu - avatar