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 Python Basics All Together Now Handle Exceptions

Invalid Literal error


tickets_remaining = 100  

while tickets_remaining >0:
    print("tickets remaining are {}".format(tickets_remaining))
    name = input("Please, enter your name  ")
    Number = (input("{}, how many tickets would you like to buy  ".format(name)))
        number = int(number)
    except ValueError:
        print ("Try again")
        Price = TICKET_PRICE * Number
        print("Total price is {}".format(Price))
        option = input("Do you want to proceed (Y/N)?  ")
        if option.upper() != "N":
            print ("SOLD!")
            tickets_remaining -= Number
            print("Thanks {}".format(name))
print("Sold Out")

error showing up when a word is entered for the number tickets requested.

2 Answers

Dan B
Dan B
6,155 Points

Well why didn't you share the solution because many other people are having the problem Vaibhav Kalra...

format ur code it’s very difficult to track the problem

got the solution.