Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # random_module.py
- from random import *
- for x in range(10):
- print random()
- print '='*27
- z = ['one', 'two', 'three', 'four', 'five', 'six']
- for x in z:
- # picks a random element from a list
- print choice(z)
- print '='*27
- # randomly attach elements
- for x in range(10):
- shuffle(z) # shuffle modifies the element in place so you have to call it beforehand
- print " ".join(z)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement