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.

Python Python Basics All Together Now Gather Information

chaou youva
chaou youva
3,646 Points

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


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
Chris Freeman
Treehouse Moderator 67,637 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!!!