import random for i in range(10): x = random.random() print(x)
The function randint takes parameters low and high and returns an integer between low and high (including both).
>>> random.randint(5, 10) 5 >>> random.randint(5, 10) 9 To choose an element from a sequence at random, you can use choice: >>> t = [1, 2, 3] >>> random.choice(t) 2 >>> random.choice(t) 3