+ 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 ÂŻ\_(ă)_/ÂŻ
5 Answers
+ 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
+ 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!")
+ 4
elif is used to check more than two case.
+ 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
+ 2
thank you guys so much ^-^ it really helped me out