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

Python Python Basics All Together Now Gather Information

chaou youva
chaou youva
3,647 Points

My script won't multiply two variables and I don't know why.

TICKET_PRICE = 10

tickets_remaining = 100  
#Tells how much there are tickets left to the user
print("There are {} tickets remaining.".format(tickets_remaining))

#Gather user name 
user_name = (input("Hi, what is your name?  "))

#How much tickets the user want to buy
tickets_number = (input("Hey {}, how much tickets do you want?  ".format(user_name)))
tickets_number = int()
#output tickets price for the user
ticket_total_price = tickets_number * TICKET_PRICE 

print("It'll cost you {}$".format(ticket_total_price))

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,441 Points

Hey chaou youva, the error appears to be in this line

tickets_number = int()

This sets tickets_number to 0.

Did you mean to use

tickets_number = int(tickets_number)

Post back if you need more help. Good luck!!!