COSC 101 expression practice (beta!)

Report any problems to jsommers@colgate.edu

Generate expressions using these types:






# Assume the following assignments have been made in Python
a = True
b = -1.0
c = 'Haim Joel cowl'
d = [a or a,a or a,a or True,False]
e = {-4:c,0:c,-1:c,-6:c}
ExpressionYour Answer
1. len(d) 4
2. list(e.items()) [(-4, 'Haim Joel cowl'), (0, 'Haim Joel cowl'), (-1, 'Haim Joel cowl'), (-6, 'Haim Joel cowl')]
3. str(not a) 'False'
4. True not in d and False False
5. (list(e.items())[0:1])[0:1:2] [(-4, 'Haim Joel cowl')]
6. d.index(False) 3
7. (len(d) / -5) - -1.7 0.7
8. -b != 1.5 True
9. str((not False in d)) 'False'
10. a and a True
Check Answers