forked from imtiazahmad007/PythonCourse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassignment_03.py
More file actions
61 lines (20 loc) · 716 Bytes
/
assignment_03.py
File metadata and controls
61 lines (20 loc) · 716 Bytes
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
# Assignment 3:
"""
There is a list shown below titled original_list.
Using only what you've learned so far in the course,
write code to create a new list that contains the tuple sorted.
IMPORTANT: you must do this programmatically! Don't just
hard code a new list with the values rearranged.
"""
original_list = ['cup', 'cereal', 'milk', (8, 4, 3)]
# your code below:
# Solution
# num1 = original_list[3][0]
# num2 = original_list[3][1]
# num3 = original_list[3][2]
# new_list = [num1, num2, num3]
# new_list.sort()
# new_tuple = (new_list[0], new_list[1], new_list[2])
# new_list = [original_list[0], original_list[1], original_list[2], new_tuple]
#
# print(new_list)