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:1,3:-8,-6:6}
b = 'ouzo Ezri'
c = False
d = -2.1
e = [True]
ExpressionYour Answer
1. (str(b.find('r'))).isupper() False
2. int(d) -2
3. (e + list(range(5)) + [-2 in a,list(a.items())])[1:3:8] [0]
4. d - -9 - -2.3 9.2
5. (str(c).lower()).strip() 'false'
6. len((str(True not in e))) 5
7. int((d - d - 4)) -4
8. (-2 in a == True) != c False
9. len(b) 9
10. -6 not in a and c False
Check Answers