Number guess excercise error

Hello gentlemen

On excercise “number guess”( when running the command to run the program the following error appears:

File, line 9 return guess

indentationerror: unindent does no entation level

Even though I have copied the same code from the walkthrough video.

What is the problem?

Here is my code:

#This programs rolls two dices and asks the user to guess what the sum of the two dices are. If the user guesses the correct sum the user is notified that he won.

from random import randint
from time import sleep

def get_user_guess():
	guess = int(raw_input("Guess a number: "))
    return guess

def roll_dice(number_of_sides):
	first_roll = randint(1, number_of_sides)
  second_roll = randint(1, number_of_sides)   
  max_val = number_of_sides * 2
  print "The maximum possible value is %d" % max_val
  guess = get_user_guess()
  if guess > max_val:
    print "Your guess is invalid"
   print "Rolling..."
   print "%d" % first_roll
   print "%d" % second_roll
   total_roll = first_roll + second_roll
   print total_roll
   print "Result..."
   if guess == total_roll
     print "Congratulations, you win!"
     print "You lost"
1 Like

Seems like you have some extra spaces or tabs here and there. Check your indentation ;).

1 Like

Thanks, I got it to work :slight_smile:


delete, I got it to work.