Build a Movie Ticket Booking Calculator - Step 20

Tell us what’s happening:

please tell me whats wrong with my code, it says write elif statment!!

Your code so far

base_price = 15
age = 21
seat_type = 'Gold'
show_time = 'Evening'

if age > 17:
    print('User is eligible to book a ticket')

if age >= 21:
    print('User is eligible for Evening shows')
else:
    print('User is not eligible for Evening shows')

is_member = False
is_weekend = False

discount = 0
if is_member and age >= 21:
    discount = 3
    print('User qualifies for membership discount')
else:
    print('User does not qualify for membership discount')
print('Discount:', discount)

service_charges = 0
if age >= 21 or (age >= 18 and (show_time != 'Evening' or is_member)):
    print('Ticket booking condition satisfied')
    base_price = 15
age = 21
seat_type = 'Gold'
show_time = 'Evening'

if age > 17:
    print('User is eligible to book a ticket')

if age >= 21:
    print('User is eligible for Evening shows')
else:
    print('User is not eligible for Evening shows')

is_member = False
is_weekend = False

discount = 0
if is_member and age >= 21:
    discount = 3
    print('User qualifies for membership discount')
else:
    print('User does not qualify for membership discount')
print('Discount:', discount)

service_charges = 0
if age >= 21 or (age >= 18 and (show_time != 'Evening' or is_member)):
    print('Ticket booking condition satisfied')
    service_charges = 0
    if seat_type == 'Premium':
        service_charges = 5
    elif seat_type == 'Gold':
        service_charges = 3
    else:
        service_charges = 1
else:
    print('Ticket booking failed due to restrictions')


# User Editable Region

print('Service charges:', service_charges)   

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36

Challenge Information:

Build a Movie Ticket Booking Calculator - Step 20

You did not write this code in the right place. Here’s the instruction:

Below the if...elif..else statement, use the print() call to display a message that shows Service charges: followed by the updated value of service_charges .

The red line show the if/elif/else block you were writing in.

if is_member and age >= 21:

    discount = 3

    print('User qualifies for membership discount')

else:

    print('User does not qualify for membership discount')

print('Discount:', discount)



service_charges = 0

if age >= 21 or (age >= 18 and (show_time != 'Evening' or is_member)):

    print('Ticket booking condition satisfied')

    service_charges = 0

    if seat_type == 'Premium':

        service_charges = 5

    elif seat_type == 'Gold':

        service_charges = 3

    else:

        service_charges = 1

    print('Service charges:', service_charges) 

else:

    print('Ticket booking failed due to restrictions')

it says use elif statement .. this is not learning ..

I’ve edited your post to improve the readability of the code. When you enter a code block into a forum post, please precede it with three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add the backticks.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

This is in your code twice.


It looks like you may have changed the starting code in areas you were not asked to change, which will cause the tests to fail. Please click the reset button to restore the original code and try again.

image