python scramble up elements in list
>>> import random >>> thelist = ['a', 'b', 'c', 'd'] >>> random.shuffle(thelist) >>> thelist ['d', 'a', 'c', 'b']
Here is what the above code is Doing:
1. We import the random module.
2. We create a list of four letters.
3. We use the shuffle() function to shuffle the list.
4. We print the list to see the result.