CSci 150: Foundations of computer science
Home Syllabus Readings Projects Tests

printable version

Test 3

[1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Problem X3.1.

[10 pts] Tabulate how the variables i, x, and y change while executing the below program fragment.

data = [23571113]
y = 0
for i in range(5):
    x = data[i] % 4
    if x >= y:
        y = y + x