Number Guess : Not responding to an entered number


#1

The last step tells me to enter python NumberGuess.py, and it works. But when I enter a number, nothing happens. Apparently, it has to prompt a question, but nothing happens.


from random import randint
from time import sleep

def get_user_guess():
  user_guess = int(raw_input("What's your guess, player?"))
  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_sdes * 2
  print "The grand maximum value is . . . *drum roll* " + str(max_val)
  sleep(1)
  user_guess = get_user_guess()
  if user_guess > max_val:
    print "I'm sorry, but you have overmaximumgitus. You can only cure yourself by making your number choice below the maximum value. Please, save yourself!"
    return
  else: 
    print "Dice rolling in the deep~"
    sleep(2)
    print "The first value enters from the cave of a monster's mouths from the depths of its belly: %d" % first_roll
    sleep(1)
    print "The second value comes from under the ocean from a living breathing underwater volcano.: %d" % first_roll
    sleep(1)
    total_roll = first_roll + second_roll
    print "The total is. . . da dum dum . . ."
    sleep(1)
  if user_guess > total_roll:
      print "You won a hundred adorable martians to command! Oh, the possibilities!"
      return
  else:
      print "You have lost. The grave beckons you, but you can still rise from the dead."
      return
      roll_dice(6)



PS: Is there a way for the statements to be randomly generated as well and I could add more to it?


#2

the function call (last line) should be outside/after the function, given the call executes the function.


#3

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