Skip to Content
Conditionals & Control Flow
I Got 99 Problems, But a Switch Ain't One

elif is short for “else if.” It means exactly what it sounds like: “otherwise, if the following expression is true, do this!”

if 8 > 9: print "I don't get printed!" elif 8 < 9: print "I get printed!" else: print "I also don't get printed!"

In the example above, the elif statement is only checked if the original if statement is False.



On line 2, fill in the if statement to check if answer is greater than 5.

On line 4, fill in the elif so that the function outputs -1 if answer is less than 5.

Folder Icon

Take this course for free

Already have an account?