import random # random(): random float between 0.0 and 1.0 (including 0.0 but not 1.0) for i in range(10): x = random.random() print(x) # randint() takes parameters low and high and returns an integer between low and high (including both) random.randint(5, 20) # to choose an element from a sequence at random: t = ['a', 'b', 'c'] random.choice(t)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter