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 trialLynn Collins
10,080 PointsI cannot get the tickets to subtract! Honestly, so FRUSTRATED@!!!
I am trying to get the remaining tickets to print. What am I doing so wrong? Honestly, I want to GIVE UP
Abdullah Al-Romaihi
2,172 Pointstickets_remaining = tickets_remaining - tickets_needed
tickets_needed is the prompt that the user replies to
4 Answers
Steven Parker
231,271 PointsYou'd need to post more of the code to be sure, but if "tickets_needed" is assigned from an "input" it would be a string. You'd need to convert it to a number before you could subtract it.
tomaszfurmanczyk
Full Stack JavaScript Techdegree Student 18,242 PointsAutomatically python defaults to a string datatype and this is why you need to simply convert tickets_needed:
tickets_remaining = tickets_remaining - int(tickets_needed)
Lynn Collins
10,080 PointsWhy do I keep losing my temper over my code not being right???? Am I crazy or what!
m3shack
Python Development Techdegree Student 279 PointsCoding can definitely make you rethink your life choices, but its the ride that makes it enjoyable. Take a break even if it is for a day or two and come back to it. I have been sketching on my ipad with procreate to help take the edge off. Dont give up ever you will be much happier once you complete your goal.
Lynn Collins
10,080 Pointssorry I love coding but when I keep getting it wrong I lose it...I don't seem to have patience with it. So after following the suggestions here I do believe I have finally nailed it to the wall...thx
Steven Parker
231,271 PointsPerhaps having lots of opportunity to practice having patience with yourself will be a bonus benefit of learning programming.
Chris Freeman
Treehouse Moderator 68,454 PointsChris Freeman
Treehouse Moderator 68,454 PointsWould like to help. Can you post your code?