Some solutions

I don't think that looking at the following is a good idea, but several students are insisting that they want solutions for my sample test questions, so here they are.

But really, understanding the solutions below is much less useful than doing the work yourself. Solving the sample test questions yourself is the preparation I recommend for the test. Reading my sample solutions is not something I recommend.

Anyway...
I think that the following are right, but please let me know if you think I made a mistake...

1. =IF(B4>90,B4,IF(B4+$B$1>90,90,B4+$B$1))

2.

for x in ['like', 'dislike', 'am indifferent to']:
    print 'I', x, 'cheese'

3.

for i in range(10):
    if i != 5:
        print i

4. see the programs written in lecture in unit V, especially 1hms.py.

5.

i = 1
while i*i <= 1000:
    i = i + 1
print i*i


[test 2 information]
[main course page]