Skip to content

Commit 54b9a07

Browse files
authored
Create unit7_ex7.1.3.py
1 parent 152cf25 commit 54b9a07

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

Diff for: unit7_ex7.1.3.py

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# exercise 7.1.3 from unit 7
2+
'''
3+
Here are two pieces of code that include a while loop. Match each loop with the output obtained when it runs.
4+
5+
Choose the output obtained by running each of the loops.
6+
7+
Guidelines
8+
9+
It is recommended to use tracking tables.
10+
'''
11+
12+
# 1
13+
14+
i = 11
15+
while i > 0:
16+
i -=1
17+
if i == 5:
18+
break
19+
print(i)
20+
21+
# Answer: 10 next line 9 than 8 7 6
22+
23+
# 2
24+
25+
i = 11
26+
while i > 0:
27+
i -=1
28+
if i == 5:
29+
continue
30+
print(i)
31+
32+
# Answer: 10 next line 9 than 8 7 6 4 3 2 1 0

0 commit comments

Comments
 (0)