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

Code won't run?

TICKET_PRICE = 10

tickets_remaining = 100  

#output how many tickets are remiaing using tickets_remaining variable

print("There are {} tickets remaining".format(tickets_remaining))

#gather users name and assign it a new variable

name = input("What is your name?    ")

ticketpurchase = input("{} how many tickets would you like to purchase?".format(name))
ticketpurchase = int(ticketpurchase)


tickettotalcost = ticketpurchase * TICKET_PRICE

print("it will cost you ${}".format(ticketotalcost))```

**Mod Note: ** Edited to add forum markdown

3 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,254 Points

Hi Kalvin, Welcome to Treehouse :)

It looks like Kris has provided the solution for you but I just wanted to let you know a bit more about forum markdown for when you post your code in the future so it looks

print("like this");

Use the 3 backtick characters and the name of the language you're posting in to use code formatting in the forum. :)

e.g. ` x 3

Have a look at the edited version of your post to see how I did it or alternatively look at the Markdown Basics course in the library to get up to date on Markdown.

Good luck and happy coding! :)

You have variable tickettotalcost but then in the following line you attempt to print ticketotalcost (missing a t)

Kalvin, Try to write names using underscores xxx_xxx ex: your wrote : tickettotalcost insted of: ticket_tottal_cost it looks much more better, and you will easy find that kind of mistakes