jeudi 10 octobre 2019

Function is not executing function inside nested while loop

I am new to python and i am trying to run this simple nested while loop program but my code is neither showing any errors nor it is executing the function

import random

player_decision = input("Do you want to roll the Dice ? Type y or n:  ").lower()

if player_decision == "y":
    game_on = True

else:

    game_on = False
    print("Thanks for your time!!")

while game_on is True:
    print("Welcome")

    roll_dice = input("Press R to roll the dice or Q to quit the game  ").upper()

    while roll_dice == "R":
        def rolling():
            outcome = random.randint(1,7)
            print(outcome)

    rolling()





Aucun commentaire:

Enregistrer un commentaire