Skip to content

Commit 75ea139

Browse files
authored
Create unit9_ex8.1.1.py
1 parent 23e3b42 commit 75ea139

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

unit9_ex8.1.1.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# exersice 8.1.1 from unit 8
2+
'''
3+
Here are four pieces of code. Choose the output obtained by running each of the code segments.
4+
'''
5+
6+
# 1:
7+
tuple_one = (1, 2, 3, 4 )
8+
tuple_one[1:-1]
9+
10+
# Answer: (2,3)
11+
12+
# 2:
13+
tuple_two = (2, 5, 8, 3, 6, 9)
14+
for i in range(0, len(tuple_two), 3):
15+
print(tuple_two[i])
16+
17+
# Answer: 2 and after 3
18+
19+
# 3:
20+
tuple_three = (2, 1, 3)
21+
tuple_three.sort()
22+
23+
# Answer: error
24+
25+
# 4:
26+
tuple_four = (4, 2, 3)
27+
sorted(tuple_four)
28+
29+
# Answer: [2, 3, 4]

0 commit comments

Comments
 (0)