Skip to content

If Statements

Create a pizza.py file to follow along.

If

topping = 'pepperoni'

if topping == 'pepperoni':
    print('Your pepperoni pizza is ready!')
Your pepperoni pizza is ready!

Else If

topping = 'mushroom'

if topping == 'pepperoni':
    print('Your pepperoni pizza is ready!')
elif topping == 'mushroom':
    print('Your mushroom pizza is ready!')
Your mushroom pizza is ready!

Else

topping = ''

if topping == 'pepperoni':
    print('Your pepperoni pizza is ready!')
elif topping == 'mushroom':
    print('Your mushroom pizza is ready!')
else:
    print('Your cheese pizza is ready!')
Your cheese pizza is ready!

Bug

Notice a bug? Edit this page on GitHub or head over to the Contributing page for more details.