Ask coding questions

← Back to all posts
i don't know why it's telling me "unindent does not match any outer indentation level"
brennanmcdaniel (5)

i used if "(userGuess > secretNum):
print("You guessed " + str(userGuess) + ". Too high.")" and it said "unindent does not match any outer indentation level" on the first ":"(colon).

Comments
hotnewtop
RYANTADIPARTHI (6019)

Solution

your indentations are wrong. Try unindent the if statements, and print.

if (userGuess < secretNum):
   print("You guessed " + str(userGuess) + ". Too low.")

   if (userGuess > secretNum):
      print("You guessed " + str(userGuess) + ". Too high.")

   if (userGuess == secretNum):
      print("You guessed " + str(userGuess) + ". You win. The number was 5")

like that.
That should work

Kai_Justice (260)

Lines 17-23 need to be spaced properly.

  print("You guessed " + str(userGuess) + ". Too low.")

  if (userGuess > secretNum):
    print("You guessed " + str(userGuess) + ". Too high.")

  if (userGuess == secretNum):
    print("You guessed " + str(userGuess) + ". You win. The number was 5")

In a language that doesn't use brackets like python the amount of tabs/spaces means everything.

mesquite2234 (278)

The print has 1 indent to much. Try removing tha indent