0

why am i not able to run the program after guessing number greater than 12?

# guesses the number and compares with the die from random import randint from time import sleep def get_user_guess(): guess = int(input("Enter guess:")) 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("maximum value is %d" % max_val) guess = get_user_guess() if guess > 12: print("maximum number can be 12, enter appropriate number") return get_user_guess() else: print("Rolling.....") sleep(2) print("first roll is %d" % first_roll) sleep(1) print("second roll is %d" % second_roll) sleep(1) total_roll = first_roll + second_roll print(total_roll) print("Result....") sleep(1) if guess == total_roll: print("You have won!") else: print("You lost!") roll_dice(6)

21st Sep 2018, 4:35 PM
Digvijay Singh
Digvijay Singh - avatar
2 Antworten
+ 2
in sololearn playgroud all inputs should be given at once. when the number > 12, a second input is expected. try to enter 15 4
21st Sep 2018, 4:58 PM
davy hermans
davy hermans - avatar
0
still, it is not working!!
21st Sep 2018, 7:43 PM
Digvijay Singh
Digvijay Singh - avatar