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 trialJackson Stitzel
551 PointsWhy can't I play my Number game?
here is my code why won't it work:
import random
# generate a random number 1-10
secret_num = random.randint(1, 10)
while True:
# get a number guess from the player
guess = int(input("Guess a number between 1 and 10: "))
#pcompare guess to secret number
if guess == secret_num:
print("you got it! My number was {}".format(secret_num))
break
else:
print("Thats not it")
#print hit/miss
nakalkucing
12,964 PointsThanks! :) What error is Workspaces giving you? Specifically, which line does it say your problem is on?
2 Answers
Steven Parker
231,275 PointsThis program seems to work just fine!
Maybe it's how you are starting it up? What do you do to cause the program to begin running?
Jackson Stitzel
551 PointsI re rote all of my code and it started to work I think I had an error before
nakalkucing
12,964 Pointsnakalkucing
12,964 PointsI'd love to help. But I can't read your code. Could you please put it into proper syntax? If you don't know how to take a look at the Markdown Cheatsheet. :)