from random import randint def get_user_guess(): user_guess=int(raw_input("Guess a number:")) return user_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 possibe value is: " + str(max_val) sleep(1) user_guess=get_user_guess() if user_guess>max_val: print "no guess higher than the maximum value is allowed." return else: print "Rolling..." sleep(2) print "The first value is: %d" % first_roll sleep(1) print "The second value is: %d" % second_roll total_roll=first_roll+second_roll print "Result..." if user_guess>total_roll: print "You have won" return else: print "You are a loser!!!" return roll_dice(6)
Hello, i am not totally happy with the indenting TBH as some of the later Boolean phrases seem out of the function to me. But anyhow, the 'else' phrase line 16, the precedes the 'print "Rolling..."' line, is coming up as a syntax error. As far as I can make out it looks identical to what is displayed in the hints. The 'return' above it I have actually indented to be in line with the 'print'. Am sure there is an error i am just not seeing.
Thank you for your help in advance.