Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Whats wrong with the elif?
#1
>>> x = int(input("Please enter an integer: "))
Please enter an integer: 42
>>> if x < 0:
x = 0
print('Negative changed to zero')


>>> elif x == 0:

SyntaxError: invalid syntax
>>>



I was trying to run through the Python tutorial. This is 4.1
Reply


Messages In This Thread
Whats wrong with the elif? - by inunanimous93 - Nov-29-2020, 08:45 PM
RE: Whats wrong with the elif? - by Axel_Erfurt - Nov-29-2020, 09:29 PM
RE: Whats wrong with the elif? - by bowlofred - Nov-30-2020, 03:40 AM
RE: Whats wrong with the elif? - by deanhystad - Nov-30-2020, 03:58 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Am I wrong or is Udemy wrong? String Slicing! Mavoz 3 2,577 Nov-05-2022, 11:33 AM
Last Post: Mavoz
  Whats Wrong!? rjay81 3 2,266 May-13-2020, 08:02 PM
Last Post: rjay81
  Can u see this code and tell whats wrong with it? AhmadKamal 14 5,342 Apr-29-2020, 11:09 AM
Last Post: jefsummers
  python gives wrong string length and wrong character thienson30 2 3,025 Oct-15-2019, 08:54 PM
Last Post: Gribouillis
  Whats a good design/approach? hshivaraj 1 1,785 Sep-16-2019, 01:44 AM
Last Post: snippsat
  Whats the right way to refactor this Big if/elif/elif ? pitosalas 1 2,257 Jul-28-2019, 05:52 PM
Last Post: ichabod801
  elevator simulator...whats the wrong at this code? tasos710 5 5,928 Jun-11-2019, 01:38 AM
Last Post: micseydel
  whats the difference between sys.exit() and break? mitmit293 1 4,124 Jan-27-2019, 09:46 PM
Last Post: ichabod801
  Whats wrong with this code? student1 1 2,406 May-18-2018, 04:19 PM
Last Post: skorpius_
  I have no clue whats wrong... Jack_03 1 2,838 Sep-28-2017, 05:36 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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