Build a Movie Ticket Booking Calculator - Step 9

Tell us what’s happening:

Im trying to understand why using an f string for the last print call doesn’t pass, is my f string incorrect?

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

discount = 0
if is_member:
    discount = 3
    print('User qualifies for membership discount')

# User Editable Region

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

print(f"Discount: {discount}")

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36

Challenge Information:

Build a Movie Ticket Booking Calculator - Step 9

Did the instructions ask you to use an f-string? Try printing it without that.

It’s not wrong but did you read the feedback?

You should have print('Discount:', discount) below your if...else statement.

// running tests
3. You should have print('Discount:', discount) below your if...else statement.
// tests completed

Thanks for your help, I did get it to pass with print(‘Discount:’, discount),

It said use the print() call to display a message that shows Discount: followed by the updated value of discount

I’m tring to understand why the f string would fail, would it display something different in the terminal, to the line print(‘Discount:’, discount) or is it the case that its just testing for that paticular line?

You were not asked to use an f-string in the instructions.

This test does check for this exact line.

Tests aren’t usually that strict, they tend to check the output, but this lesson is about this particular syntax, given in the example code.

Thankyou, for your explanation

1 Like

I am at this challenge, step 15, and I was wondering if we were actually asked to use the (f) print feature in step 9.

In the future, please create your own topic when you have specific questions about your own challenge code. Only respond to another thread when you want to provide help to the original poster of the other thread or have follow up questions concerning other replies given to the original poster.

The easiest way to create a topic for help with your own solution is to click the Ask for Help button located on each challenge. This will automatically import your code in a readable format and pull in the challenge url while still allowing you to ask any question about the challenge or your code.

Thank you.

1 Like