mardi 10 octobre 2017

(Python) while loop is breaking my random_number

so I'm doing a project where it basically chooses a random number from 1 - 6 as a mini project.

On the most part, it works. But when it loops back up, it seems to keep on rolling the same number.

Here's a screenshot of what I mean - http://ift.tt/2yDa0Js As you can see, the dice number keeps on rolling the same. Can you see what is wrong in my code?

# Useful module for selecting random numbers
import random

# Loop program back to here once user presses anything
loop = 1

#Chooses random number between 1 - 6
Random_Number = (random.choice([1,2,3,4,5,6]))

while (loop < 10):
    #Printing what the user sees
    print ("===============================")
    print ("Your random dice number is:", Random_Number)
    input("Press any key to roll again")
    print ("===============================")

    #looping back to "loop = 1"
    loop = loop + 1




Aucun commentaire:

Enregistrer un commentaire