Learn

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.

Instructions

1.

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.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?