pimento[~]$ pimento[~]$ pimento[~]$ cd cs21/practice/ pimento[practice]$ pimento[practice]$ pimento[practice]$ pimento[practice]$ pimento[practice]$ pimento[practice]$ atom stretch.py pimento[practice]$ cd ../ pimento[cs21]$ cd inclass/week02/ pimento[week02]$ atom len_loop.py pimento[week02]$ cd ../ pimento[inclass]$ cd ../practice/ pimento[practice]$ python3 stretch.py Enter a string: weekend w e e k e n d pimento[practice]$ python3 stretch.py Enter a string: weekend ww ee ee kk ee nn dd pimento[practice]$ python3 stretch.py Enter a string: weekend ww wwee wweeee wweeeekk wweeeekkee wweeeekkeenn wweeeekkeenndd pimento[practice]$ python3 stretch.py Enter a string: weekend wweeeekkeenndd pimento[practice]$ pimento[practice]$ python3 Python 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> >>> >>> import random >>> >>> >>> coin = ["H","T"] >>> type(coin) >>> >>> random.choice(coin) # input is a sequence 'H' >>> random.choice(coin) 'H' >>> random.choice(coin) 'H' >>> random.choice(coin) 'H' >>> random.choice(coin) 'H' >>> random.choice(coin) 'T' >>> random.choice(coin) 'T' >>> random.choice(coin) 'H' >>> random.choice(coin) 'H' >>> random.choice(coin) 'T' >>> random.choice(coin) 'H' >>> random.choice(coin) 'H' >>> >>> >>> letters = "hello" >>> random.choice(letters) 'l' >>> random.choice(letters) 'h' >>> random.choice(letters) 'e' >>> random.choice(letters) 'o' >>> random.choice(letters) 'o' >>> random.choice(letters) 'e' >>> random.choice(letters) 'h' >>> random.choice(letters) 'o' >>> exit() pimento[practice]$ cd ../ pimento[cs21]$ cd inclass/week03 pimento[week03]$ atom random_average.py pimento[week03]$ python3 random_average.py How many trials? 20 5 3 3 4 3 4 3 5 2 5 2 3 3 2 4 4 1 3 3 1 pimento[week03]$ pimento[week03]$ pimento[week03]$ pimento[week03]$ python3 random_average.py How many trials? 20 61 pimento[week03]$ pimento[week03]$ pimento[week03]$ pimento[week03]$ python3 random_average.py How many trials? 20 3.05 pimento[week03]$ pimento[week03]$ pimento[week03]$ python3 random_average.py How many trials? 3 2.0 pimento[week03]$ python3 random_average.py 10 How many trials? 10 3.5 pimento[week03]$ python3 random_average.py How many trials? 100 3.02 pimento[week03]$ pimento[week03]$ pimento[week03]$ python3 random_average.py How many trials? 1000 3.019 pimento[week03]$ python3 random_average.py How many trials? 1000000 3.001188 pimento[week03]$ python3 Python 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> >>> >>> result = True >>> type(result) >>> result = False >>> type(result) >>> >>> 3 < 5 True >>> type(3 < 5) >>> >>> >>> 3 < 2 False >>> >>> >>> 3 == 2 False >>> 3.0 == 3 True >>> 3 != 2 True >>> "hello" == "hello " False >>> "a" < "b" True >>> >>> result = ("a" < "b") >>> type(result) >>> result = 3 == 2 >>> result False >>> >>> >>> x = 10 >>> if x < 20: ... print("hello") ... hello >>> x = 30 >>> if x < 20: ... print("hello") ... >>> exit() pimento[week03]$ pimento[week03]$ pimento[week03]$ atom conditionals1.py pimento[week03]$