Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Jason Pallone
895 PointsCan someone tell me why im getting this error for this code? Python
import random def jason(): secret_num = random.randint(1,10) guesses = [] while len(guesses) < 5: try: guess = int(input("guess a number between 1 and 10: ")) except ValueError: print("{} is not a number".format(guess)) else:
if guess == secret_num:
print("you got it! my number was{}".format(secret_num))
break
elif guess < secret_num:
print("to low my number is greater than {}".format(guess))
else:
print("to high my number is lower than {}".format(guess))
guesses.append(guess)
else:
print("not this time, my number was {}".format(secret_num))
play_again = input("do you want to play again? yes or no")
if play_again != "no":
else:
print("see you later!")
i'm getting this error, i indented the else, that did not fix it, but i want it to say that print so wouldn't it need to stay where it is anyways?
File "number.py", line 24
else:
^
IndentationError: expected an indented block

Steven Parker
221,254 PointsTry formatting your code so we can see the actual spacing.
Use the instructions for code formatting in the Markdown Cheatsheet pop-up below the "Add an Answer" area.
Or watch this video on code formatting.
Jason Pallone
895 PointsJason Pallone
895 Pointsline 24 is the very bottom else of the code