## 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.

# When I get to total my code spits out "your total is None." I'm not sure how I am getting this. Iv been following along.

TICKET_PRICE = 10

tickets_remaining = 100

def calculate_price(num_tickets): result = num_tickets * TICKET_PRICE

while tickets_remaining > 0: print("There are {} tickets remaining.".format(tickets_remaining)) name = input("What is your name?\n") number_of_tickets = (input("How many tickets would you like {}?\n".format(name))) try: number_of_tickets = int(number_of_tickets) if number_of_tickets > tickets_remaining: raise ValueError(" There are only {} tickets remaining.".format(tickets_remaining)) # Raise value error if request is for more tickets than are available except ValueError as err: #include error text in the output print("Make sure you enter a valid number and try again.{}".format(err)) else: total = calculate_price(number_of_tickets) print("{}, your total is {}.".format(name, total)) proceed = input("Would you like to proceed {}? Y or N\n".format(name)) if proceed.capitalize() == "Y": # TODO: Gather CC info print("Sold!") tickets_remaining = tickets_remaining - number_of_tickets print(tickets_remaining, "Ticket remaining.") elif tickets_remaining == 0: break else: print("Thank you anyways, {}.".format(name))

print("Sold Out!")

There should be another line in the function that says `return result`
Alternatively you don't need to assign the result variable at all and can just return the outcome of the calculation within the function like this: `return num_tickets * TICKET_PRICE`