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!

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


why err


tickets_reamining = 100

def calculate_price(number_of_tickets):
    return number_of_tickets * TICKET_PRICE * SERVICE_CHARGE

    while tickets_reamining >= 1:
        print("there are {} tickets reamining.".format(tickets_reamining))
        name = input("whats your name ?  ")
        tickets_you_want = input("how many tickets you want {} ".format(name))
            tickets_you_want = int(tickets_you_want)
            if tickets_you_want > tickets_reamaning:
                raise ValueError("there are on an  x amount of tickets left try again man")
        except ValueError as err:
            print("oh no that doesnt make that much sence type something that makes sence..")
            ammount_due = calculate_price(num_tickets)
            print("the total is {}".format(ammount_due))

            keep_going_man = input("do you wanna continue  ? y/n ")
            if should_prossed.lower() == "y":
                print("sold please come by again dear")
                tickets_remaining -= num_tickets
                print("try again")

1 Answer

Clayton Perszyk
Clayton Perszyk
Treehouse Moderator 48,602 Points

Not sure what error you're getting, but nothing after the return statement will run as return breaks out of the function.

Also, you want to use raw_input for strings (ie text) and input for integers.

Also, tickets_remaining is spelled differently throughout your code.