Numberguess nothing happens in terminal


#1

My code used to work fine, now when I try to start it with python NumberGuess.py, nothing shows up after that

It should say : The maximum value is: 12



"""Guess the number correct and you win, guess it  wrong and  you lose!"""
from random import randint
from time import sleep
def get_user_guess():
  guess = int(raw_input("Make your 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 "The maximum value is: %d" % max_val
  guess = get_user_guess()
  if guess > max_val:
    print "Invalid guess!"
    return
  else:
    print "Rolling..."
    sleep(2)
    print "The first roll is: %d" % first_roll
    sleep(1)
    print "The 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 won!"
    elif guess < total_roll:
       print "You lost :<"
    roll_dice(6)
      



#2

the function call:

roll_dice(6)

executes the function, as such it should be outside/after the function. Currently, no function calls are reached within your code


#3

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