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 = 2.2
b = {2:'nesh',-1:'dors Sil',-8:'Rob Cory'}
c = True
d = [False,False,False,str(c)]
e = 9
ExpressionYour Answer
1. len(b) < a False
2. -a - 3 -5.2
3. str(c) 'True'
4. int(a) 2
5. list(b.items()) + list(range(5)) [(2, 'nesh'), (-1, 'dors Sil'), (-8, 'Rob Cory'), 0, 1, 2, 3, 4]
6. (str(False not in d)).isalpha() True
7. (str(c).strip()).split('u') ['Tr', 'e']
8. round(e // 5 / 6, 2) 0.17
9. int(e / e) 1
10. d.index(False) 0
Check Answers