vendredi 13 avril 2018

python random list always same, but different in other computers

import random
score=[]
random.seed(1)
for i in range(0,100):
    score.append(random.randrange(0,21))

for k in range(20, -1, -1):
    print("Who get %2d score in test? : "%(k), end='')
    while score.count(k)!=0:
        j = score.index(k)
        print("%3s" % (j), end="  ")
        score.remove(k)
        score.insert(j,25)
    print("\n")

I wrote this code for my homework. But when I'm running it, its result is always same even I have used import random. Ironically, in other computers, like friend's computer, code get different result but it repeat again. What's wrong in my code?




Aucun commentaire:

Enregistrer un commentaire