Build a movie ticket Booking step 9

I’m getting the same error over and over. It is saying: You should have print('Discount:', discount) below your if...else statement.

I looked for spaces, tried with and without an extra line. No spelling mistake.

Here’s my code:


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 = True

is_weekend = False



discount = 0

if is_member:

    discount = 3

    print('User qualifies for membership discount')

else:

    discount = 0

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

print('Discount is:', discount).

Can someone help me? I looked at the other topics, but didn’t find an answer.

I’ve edited your post to improve the readability of the code. Please check the accuracy of the indentation and if it’s not accurate please post again your code.

Can you also post a link to the step?

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 (').

Thank you. So de link is: https://www.freecodecamp.org/learn/python-v9/workshop-movie-ticket-booking-calculator/step-9 The code are correct. I’m I doiing something wrong of is there a bug in the system?

Why are you giving discount a new value in the else statement. Also check what the last print needs to display exactly

are you sure the code is correct? I see this error in the terminal

Traceback (most recent call last):
  File "main.py", line 47
    print('Discount is:', discount).
                                    ^
SyntaxError: invalid syntax

It was not in my code, but I see it is in yours. I tried it several times now and removed everything. Now it’s okay and I’m in step 10. Thanks for wanting to help me!

I do think it’s a bug. I did’t do anything different this time.

Sometimes those browser-based editors can be a bit finicky with how they track changes. Resetting the step is usually the best “first move” when things seem correct but won’t pass.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.