i still dont really understand elif that well? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 3

i still dont really understand elif that well?

can someone please explain it differently than the lesson does? lol sorry if i seem stupid but i just dont understand it that well ¯\_(ツ)_/¯

16th Dec 2017, 1:20 AM
:hyperthonk:
:hyperthonk: - avatar
5 Réponses
+ 2
elif, also known as else if, simply adds am additional condition to your if statement. ex. if (1>3) do this elif (1>2) do that else do something else Hope that makes sense
16th Dec 2017, 1:32 AM
Nope
Nope - avatar
+ 7
It's like if [test1]: # If this test is true, then do this thing: [this thing] elif [test2]: # however if that wasn't true but this test is true, then do this other thing: [this other thing] else: # otherwise if they both weren't true, then do this instead: [this instead] e.g. age = int(input("What's your age?")) if age > 68: print("You are older than me.") elif age < 68: print("You are younger than me.") else: print("We are the same age!")
16th Dec 2017, 2:00 AM
David Ashton
David Ashton - avatar
+ 4
elif is used to check more than two case.
16th Dec 2017, 4:08 AM
husen
husen - avatar
+ 3
if x=1 then football else if x=2 then basketball else if x=3 then hockey else if x>3 then some other sport
16th Dec 2017, 2:23 AM
manny
+ 2
thank you guys so much ^-^ it really helped me out
18th Dec 2017, 3:34 AM
:hyperthonk:
:hyperthonk: - avatar