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 (2015) Number Game App Number Game Refinement

testing my apps

so I go into workspaces and write my code. I am pretty sure it works, but not entirely sure, so I want to test it out in the python shell. My file name is even_odd.py, so I go into the console, and I type in: python even_odd.py, and then I hit enter, and what comes back is treehouse:~/workspace$, and there is nothing that comes up that shows me that my code is working. Does anyone know why this is happening? please help.

Nicolas Bassano
Nicolas Bassano
2,125 Points

Hi Graham, can you share your code or a workspace snapshoot?

import random

secret_num = random.randint(1, 10)

while True guess = int(input("Pick a number between 1 and 10: "))

if guess = secret_num: print("You got it! my number was {}").format(guess) break else: print("That's not it!")

3 Answers

Nicolas Bassano
Nicolas Bassano
2,125 Points

i dont know if you have an indentation problem. Try to markdown the code so its easier to read. Another thing is that youre missing the colon after the while True.

Cheers

Steven Horowitz
Steven Horowitz
6,966 Points

Is your code within a function? If so, are you calling on that function somewhere within your script? The program won't return anything if the function isn't being called.

Thanks!