Python Forum
for / else not working in interactive mode
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
for / else not working in interactive mode
#2
The interactive interpreter wants you to end the for loop with a blank line before continuing on with more code:

Output:
>>> for i in range(5): ... print(i) ... print(0) File "<stdin>", line 3 print(0) ^ SyntaxError: invalid syntax >>> for i in range(5): ... print(i) ... 0 1 2 3 4 >>> print(0) 0
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
RE: for / else not working in interactive mode - by ichabod801 - Jul-17-2019, 01:20 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  things that work in terminal mode but not in sublime mode alok 4 3,103 Aug-11-2021, 07:02 PM
Last Post: snippsat
  interactive map and function hurc60248 1 1,851 Jan-08-2021, 09:22 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020