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
Radek Kojtych
375 PointsGot "Traceback (most recent call last)" issue after added format(err) in the very end.
TICKET_PRICE = 10
tickets_remaining = 100
while tickets_remaining >=1:
print("There are still {} tickets available".format(tickets_remaining))
name = input("What's your name? ")
num_tickets = input("Hi {}! How many tickets would you like? ".format(name))
try:
num_tickets = int(num_tickets)
if num_tickets > tickets_remaining:
raise ValueError("There are only {} tickets remaining".format(tickets_remaining))
except ValueErrror as err:
print("Oh no. {}. Please try again".format(err))
else:
total_due = num_tickets * TICKET_PRICE
print("Total due is £{}".format(total_due))
confirmation = input("Would you like to proceed {}? Y/N ".format(name))
if confirmation.lower() == "y":
print("SOLD!")
tickets_remaining -= num_tickets
else:
print("No worries")
print("Sorry, All SOLD OUT!")
1 Answer
KRIS NIKOLAISEN
54,974 PointsYour error message shows what is wrong: NameError: name 'ValueErrror' is not defined. You have one too many r's in ValueError.
Radek Kojtych
375 PointsDamnnnn ... so stuid I amm haha Cheers Kris!
Radek Kojtych
375 PointsRadek Kojtych
375 PointsError: