Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

Issue with case sensitivity

My code is working fine except for the case sensitivity with the final input - lines 22-24

I have tried formatting with .lower and .upper as well!

Any help would be appreciated!

TICKET_PRICE = 10

tickets_remaining = 100

print("There are {} tickets left!".format(tickets_remaining))

user_name = input("Hello, what is your name?? ")

number_of_tickets = input("Hey {}, how many tickets would you like? ".format(user_name)) number_of_tickets = int(number_of_tickets)

total_price = (number_of_tickets*TICKET_PRICE)

print("The amount for your tickets is ${}.".format(total_price))

confirmation = str(input("Do you want to complete the purchse? \nEnter Yes/No "))

if confirmation.casefold() == "Yes": print("SOLD!") tickets_remaining -= number_of_tickets

else: print("No worries, thanks for your visit {}!".format(user_name))

1 Answer

Have you tried adding

print(confirmation.casefold())

to see if it matches your value of 'Yes'?

The following works:

if confirmation.lower() == "yes":