CSC108_MidEV_2012F Solutions
Question 1 part a)
Solution
4
2
Explanation
x=3
y=x-1=2
x=4
print (x) = print (4)
print (y) = print (2)
Since ints are immutable, the value of y does not change when x = 4
CSC108_MidAM_2013W Solutions
Question 1 part a)
Solution
43
Explanation
1.
2.
3.
4.
k=3
w=k
k=k+1
print(k, w)
1. <k> is assigned to an int, 3.
2. <w> is assigned to the value of <k>, which is 3 (remem
CSC 108 2011S MIDTERM SOLUTIONS
Question 1)
Solution
1. 20
2.
3.
4.
5.
I like trees
1
[4, 5, 6]
[7, 8, 9, 4]
Explanation
1.
number = 10
number = func1(number)
print number 20
We can see that the varia
CSC108_MidPM_2013F Solutions
Question 1)
Solution
1.
2.
3.
4.
5.
6.
[ball, car, doll]
[ball, car]
o
Dec
False
[Dec, 6]
Explanation
1.
1.
2.
3.
4.
1. <toys> is a list of strings
2. <stuff> is equal to
CSC108_MidAM_2012F Solutions
Question 1 part a)
Solution
79
Explanation
x=4
y=x+5=9
x=7
print (x, y) = print (7 9)
Since ints are immutable, the value of y does not change when x = 7, the value used i
CSC108_MidPM_2012F Solutions
Question 1 part a)
Solution
42
Explanation
x=3
y=x-1=2
x=4
print (x, y) = print (4 2)
Since ints are immutable, the value of y does not change when x = 4, the value used i
CSC108_MidEV_2013W Solutions
Question 1 part a)
Solution
5.6 5.5
Explanation
1.
2.
3.
4.
x = 5.5
y=x
x = x + 0.1
print(x, y)
1. <x> is assigned to an int, 5.5.
2. <y> is assigned to the value of <x>,