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

My if statement is not working as intended

My entire if statement line won't run when I enter "y" into the console.

TICKET_PRICE = 10

tickets_remaining = 100
while tickets_remaining : print("There are {} tickets remaining".format(tickets_remaining))

name = input("What is your name? ")

number_of_tickets = input("Hi {}, how many tickets do you want to buy? ".format(name))
number_of_tickets = int(number_of_tickets)

total = number_of_tickets * TICKET_PRICE
print("Your total due is ${}!!".format(total))

Comfirmation = input("Do you want to proceed? Y/N    ") 

if Comfirmation.lower == "y":
    print("Sold!!")
    tickets_remaining -= number_of_tickets
else:
    print("Thank you anyways {}".format(name))

print("Sorry :(, we are all out of tickets!!")

3 Answers

ops I changed this "confirmation.lower()"

Jimmy Ma
Jimmy Ma
5,796 Points

Still need my help?

All good now

Steven Parker
Steven Parker
229,005 Points

:mailbox_with_mail: Hi, I got your requst, but it looks like you resolved your issue in the meantime.
Congratulations, and happy coding!