Tracing Assignment #1
Tracing Assignment #1
Tracing Assignment #1
Step a b c Output
1 20
2 20 10
3 20 10 10
4 20 10 10 "unfair"
5 20 10 10 "unfair"
6 20 10 10 "unfair"
Program b)
Step n1 n2 ans i Output
1 Riverside Rocks! 0
2 Riverside Rocks! 0
5 rside s! "RRvc" 1
6 rside s! "RRvc" 2
7 de "RRvcrs" 2
8 de "RRvcrs" 3 "RRvcrs"
Program c)
Line n Output
n=3 3
n=n+1 4
print n 4 4
elif n / 2 == 1: 4
print n 4
else: 4
print 5 4
while n < 5: 4
print n 4 4
n=n+1 5
while n < 5: 5
print n 5
n=n+1 6
while n < 5: 6