Number Guess project error


#1


Please help me to see whats wrong here...


from random import randint
from time import sleep

def get_user_guess():
 		user_guess = int(raw_input("Guess a number: "))
  	return user_guess
  
def roll_dice(number_of_sides):
  	first_roll = radint(1,number_of_sides)
    second_roll = radint(1,number_of_sides)
  	max_val = number_of_sides * 2
    print "The maximum possible value is: " + str(max_val)
    sleep(1)
    user_guess = get_user_guess()
    if user_guess > max_val:
      	print "No guessing higher than the maximum possible value"
        return
    else:
      	print "Rolling..."
      	sleep(2)
      	print "The first value is: %d" % first_roll
      	sleep(1)
      	print "The second value is: %d" % second_roll
      	sleep(1)
    		total_roll = first_roll + second_roll
        print "The total value from both dices is: %d" % total_roll
        print "Result..."
        sleep(1)
        if user_guess > total_roll:
          	print "You won!"
            return
        else:
            print "You lost, try again."
            return
roll_dice(6)


#2

i see a lot of indention problem:

 		user_guess = int(raw_input("Guess a number: "))
  	return user_guess

  	first_roll = radint(1,number_of_sides)
    second_roll = radint(1,number_of_sides)
  	max_val = number_of_sides * 2
    print "The maximum possible value is: " + str(max_val)

      	sleep(1)
    		total_roll = first_roll + second_roll

please verify the indent of your entire code


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.