Week 2 class demo

import random
random.seed(42)
random.randrange(1,11)
2
random.randint(1,10)
1
colors = ['red', 'green', 'blue', 'fuzzy']
random.choice(colors)
'blue'
options = ['a', 'b', 'c', 'd', 'e', 'f']
options.append('g')
print(options)
['a', 'b', 'c', 'd', 'e', 'f', 'g']
random.shuffle(options)
options
['e', 'a', 'c', 'd', 'f', 'b']
random.shuffle(options)
print(options)
None
options

[return_this for this in sequence]

{key: value for key, value in dict.items()}

Last updated

Was this helpful?