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

Jareth Vasquez
1,744 Pointserror kickback for "Handle Exceptions".
So starting with the code in question...
TICKET_PRICE = 10
tickets_remaining = 100
while tickets_remaining > 0:
print("There are {} tickets remaining.".format(tickets_remaining))
name = input("What is your name? ")
requested = input("Ok {}, how many tickets would you like to purchace today? ".format(name))
# Expext a ValueError to happen and deal with it
try:
requested = int(requested)
#raise a value error if requesting more tickets then avail and send error text
if requested > tickets_remaining:
raise ValueError("there are only {} tickets remaining".format(tickets_remaining))
except ValueError as err:
print("OOPS! somthing went wrong. {}. Please try again".format(err))
else:
total_cost = TICKET_PRICE * requested
print("Got it! so for {} tickets, you would be looking at a total of ${}".format(requested, total_cost))
buy = input("Do you want to proceed? Y/N: ")
if buy.lower() == "y":
print("SOLD!")
tickets_remaining -= requested
else:
print("No worries {}! Thanks for stopping by!".format(name))
else:
print("There are no more tickets remaining")
so the course starts with how to handle the error if the user inputs a non int (like "blue) and that part worked fine. then it went into how to handle if the user requested more tickets then available, and that works now as well. my issue is that the over value fix now kicks this msg out if i go back to plugging in "blue"
"OOPS! somthing went wrong. invalid literal for int() with base 10: 'blue'. Please try again"
Im just looking for a way to clean this up in the future. Thanks in advance!
EDIT: i just noticed the redundant else at the bottom, please disregard the n00b-ish ness