-
Notifications
You must be signed in to change notification settings - Fork 11
/
sd33.py
55 lines (41 loc) · 998 Bytes
/
sd33.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
numbers = []
increments = 0
def sd1(r):
i = 0
while i < r:
print "At the top i is %d" % i
numbers.append(i)
i = i + 1
print "Numbers now: ", numbers
print "At the bottom i is %d" % i
def sd3(r, increments):
i = 0
while i < r:
print "At the top i is %d" % 1
numbers.append(i)
i += increments
print "Numbers now: ", numbers
print "At the bottom i is %d" % i
def sd5(r):
for i in range(0, r):
print "At the top i is %d" % i
numbers.append(i)
print "Numbers now: ", numbers
print "At the bottom i is %d" % i
print "\nCall function for study drill 1 with 6 as its argument"
sd1(6);
print "The numbers: "
for num in numbers:
print num
numbers = [] # Empty the list
print "\nCall function for study drill 3 with 6 and 2 as arguments"
sd3(6, 2)
print "The numbers: "
for num in numbers:
print num
numbers = [] # Empty the list
print "\nCall function for study drill 5 with 6 as its argument"
sd5(6)
print "The numbers: "
for num in numbers:
print num