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

Ammar Mazhar
Ammar Mazhar
1,015 Points

The code won't run

For some reason every time I try to run my code by calling the file to run " python masterticket.py" the code won't run and the cursor starts a new line without any error notifications. How may I fix that problem ?

5 Answers

Steven Parker
Steven Parker
229,005 Points

If you get no errors, it's quite likely that the code did run, but it did not produce any output before it finished.

If you'd like us to be able to check for certain, make a snapshot of your workspace and post the link to it here.

Steven Parker
Steven Parker
229,005 Points

I made a fork (working copy) of your snapshot, and it seemed to work as expected:

treehouse:~/workspace$ python masterticket.py
There are 100 tickets remaining.
What is your name?Joe
How many tickets would you like, Joe?     4
The total due is $42
Do you want to proceed Y/N  y
SOLD!
There are 96 tickets remaining.      
What is your name?scalper
How many tickets would you like, scalper?     96
The total due is $962
Do you want to proceed Y/N  y
SOLD!
Sorry the tickets are all sold out!!:(
treehouse:~/workspace$

Looking at the code, I noticed that the indentation on lines 17-20 was not consistent with the rest of the program, but it did not seem to cause an issue.

I am running the masterticket.py program and even though I tell it to thank them by name at the sale, the code does not do this. what am I doing wrong? here is my snapshot https://w.trhou.se/bofrjcof1q

How is it that it is doing one thing for you and something different with you? It's not confirming the name

I see that it is confirming the name but it is not thanking them by name. I thought this script was supposed to thank the buyer by name

Steven Parker
Steven Parker
229,005 Points

The line "print("Thank you anyways, {}!".format(name))" is only used when the user does not proceed after being told the price. I didn't select that option in the example, but it does work also.

OH, I didn't understand that. But yep it does work. thanks for the help

Steven Parker
Steven Parker
229,005 Points

Kathy Kinsella — Glad to help. You can mark a question solved by choosing a "best answer".
And happy coding!