Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
216,017 Points

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