Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Else statement
#5
You have to un-indent if you are using the IDLE shell.
Output:
>>> if 5 > 3: print('hi') else: print('ho') hi
After entering "print('hi')" the next line was indented to the same level. I just hit the backspace key end entered "else:"

Your problem is you completed the if statement before entering else. You do not want to see ">>>" because that means you are done with the expression.
Reply


Messages In This Thread
Else statement - by Lass86 - Mar-08-2021, 03:31 PM
RE: Else statement - by BashBedlam - Mar-08-2021, 03:44 PM
RE: Else statement - by Lass86 - Mar-08-2021, 03:53 PM
RE: Else statement - by buran - Mar-08-2021, 04:00 PM
RE: Else statement - by Lass86 - Mar-09-2021, 08:44 AM
RE: Else statement - by deanhystad - Mar-08-2021, 04:04 PM
RE: Else statement - by Lass86 - Mar-09-2021, 08:45 AM

Forum Jump:

User Panel Messages

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