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
R Arts
18,453 PointsGather Information ( python) What i doing wrong ?
TICKET_PRICE = 10
tickets_remaining = 100
print("There are {} tickets are remaining?".format(tickets_remaining))
name = input("What is your name? ")
num_tickets = ("How many tickets would you like, {}? ".format(name)) num_tickets = int(num_tickets)
amount_due = num_tickets * TICKET_PRICE print("Het total of the ticket are ${}".format(amount_due))
What is your name? Donald
Traceback (most recent call last):
File "masterticket.py", line 11, in <module>
num_tickets = int(num_tickets)
ValueError: invalid literal for int() with base 10: 'How many tickets would you like, Donald? '
treehouse
1 Answer
Dave StSomeWhere
19,870 PointsWhat you are doing wrong is that you didn't use the input command on your prompt
# input is missing
num_tickets = ("How many tickets would you like, {}? ".format(name))
# add input and it should work
num_tickets = input("How many tickets would you like, {}? ".format(name))