-
Notifications
You must be signed in to change notification settings - Fork 1
/
hw6.py
85 lines (63 loc) · 1.46 KB
/
hw6.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Name: Chris Edwards
# Evergreen Login: edwchr30
# Computer Science Foundations
# Programming as a Way of Life
# Homework 6
# You may do your work by editing this file, or by typing code at the
# command line and copying it into the appropriate part of this file when
# you are done. When you are done, running this file should compute and
# print the answers to all the problems.
###
### Problem 3
###
# DO NOT CHANGE THE FOLLOWING LINE
print "Problem 3 solution follows:"
rounded_height = {}
rounded_height['John'] = 6
rounded_height['Mike'] = 5
rounded_height['Nate'] = 6
rounded_height['Harry'] = 7
###
### Problem 4
###
# DO NOT CHANGE THE FOLLOWING LINE
print "Problem 4 solution follows:"
print rounded_height['Nate']
rounded_height['Terry'] = 8
###
### Problem 5
###
# DO NOT CHANGE THE FOLLOWING LINE
print "Problem 5 solution follows:"
M = rounded_height['Mike']
T = rounded_height['Terry']
J = rounded_height['John']
print M
print T
print J
###
### Problem 6
###
# DO NOT CHANGE THE FOLLOWING LINE
print "Problem 6 solution follows:"
x = 0
n = 10
for i in range(n):
print x
x = x + 1
###
### Problem 7
###
# DO NOT CHANGE THE FOLLOWING LINE
print "Problem 7 solution follows:"
def wloop(y):
q = 0
while(q < y):
print "iteration counter ", q
q = q + 1
wloop(10)
###
### Collaboration
###
# ... List your collaborators and other sources of help here (websites, books, etc.),
# ... as a comment (on a line starting with "#").