import random
####################
def ListRearrange(listx):
listz = listx[:]
x = len(listx)
for y in range(x):
a = random.choice(range(x))
b = listx.pop(a)
listx.append(b)
return listx
####################
list1 = ["Hello", 5000, "60", "Timmothy", 400, "2", "Okay"]
print list1
for g in (1,2,3,4,5,6,7,8,9):
p = ListRearrange(list1)
print p
Thanks to whoever looks at this. What I am trying to do is create a randomly jumbled list. However when I run it, it doesn't seem very random at all. It is possible I am overlooking something, or that is just as random as it gets. Please get back to me when you have a chance.
Aucun commentaire:
Enregistrer un commentaire