Week 2 class demo
import randomrandom.seed(42)random.randrange(1,11)2random.randint(1,10)1colors = ['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)Noneoptions[return_this for this in sequence]
{key: value for key, value in dict.items()}
Last updated
Was this helpful?