Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
help on else condition
#2
Indentation defines code blocks in Python. Because "tirage()" is indented the same as "if response..." it marks the start of a new code block and it's execution is not affected by the if statement. You should be getting a syntax error because the "else:" does not have a corresponding "if". When I ran you code I get this message.
Output:
File "...\junk.py", line 4 else: ^ SyntaxError: invalid syntax
Reply


Messages In This Thread
help on else condition - by jip31 - May-18-2021, 05:38 AM
RE: help on else condition - by deanhystad - May-18-2021, 06:07 AM
RE: help on else condition - by Yoriz - May-18-2021, 06:09 AM
RE: help on else condition - by jip31 - May-18-2021, 06:23 AM
RE: help on else condition - by perfringo - May-18-2021, 06:31 AM
RE: help on else condition - by jip31 - May-18-2021, 06:41 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  else condition not called when if condition is false Sandz1286 10 6,038 Jun-05-2020, 05:01 PM
Last Post: ebolisa
  [HELP] Nested conditional? double condition followed by another condition. penahuse 25 8,298 Jun-01-2020, 06:00 PM
Last Post: penahuse

Forum Jump:

User Panel Messages

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