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 = {-8:-1,-3:1,-10:-8,7:6}
b = -1.2
c = -5
d = 'SCAN Gazo'
e = ['goff ango cuve','Moli']
ExpressionYour Answer
1. round((len(a) / c) - b, 2) 0.4
2. (str(b > -1.7)).find('T') 0
3. (d.lower().upper())[7:8] 'Z'
4. (b != -5 and False) or True True
5. c - 1 / c -4.8
6. list(a.items()) + [2.1,b > -1.7,-2.3] [(-8, -1), (-3, 1), (-10, -8), (7, 6), 2.1, True, -2.3]
7. str(('Moli' in e or False)) 'True'
8. (str(int(b))).split('-') ['', '1']
9. not -1 not in a False
10. (e.count('Moli') % (1+1)) % abs(c) 1
Check Answers