Assessment: python assignment statement

Oct 2, 2014 • R. David Murray

1) Given the following program:

distance = 100 # miles
speed = 50 # miles per hour
time = distance/speed
distance = 200
print(distance, speed, time)

What will the program print?

a) 100, 50, 2
b) 200, 50, 2
c) 200, 50, 4

2) Chose one line from each of the following pairs of lines and number them in the order they should be arranged so that the resulting program will print the average of 5, 7, and 9.

print(d)
print(a, b, c)

a = 5
a = 5 + 7

d = (a + b) / 2
d = b / 3

b = a + 9
b = 7 + 9