Log in from a computer to take this course

You'll need to log in from a computer to start Learn Python 2. But you can practice or keep up your coding streak with the Codecademy Go app. Download the app to get started.

apple storegoogle store
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.

Or sign up using:

Already have an account?