-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChapter_4.py
More file actions
48 lines (31 loc) · 1.02 KB
/
Copy pathChapter_4.py
File metadata and controls
48 lines (31 loc) · 1.02 KB
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
#Tuples ---------------------- and List --------------------
friends = ["apple" , 45, "banana", 3.14, True]
print(friends[0]) # Accessing the first element
friends[0] = "orange" # Modifying the first element
print(friends.append("grapes"))
print(friends.pop(2))
print(friends)
list = [1,56,89,35,245,7766,46,34,21]
list.sort() # Sorting the list in ascending order
print(list)
#Tuples are immutable, so they cannot be changed after creation
# taking from user
marks = []
m1 = int(input("Enter marks of 1st student : "))
marks.append(m1)
m2 = int(input("Enter marks of 1st student : "))
marks.append(m2)
m3 = int(input("Enter marks of 1st student : "))
marks.append(m3)
m4 = int(input("Enter marks of 1st student : "))
marks.append(m4)
m5 = int(input("Enter marks of 1st student : "))
marks.append(m5)
m6 = int(input("Enter marks of 1st student : "))
marks.append(m6)
m7 = int(input("Enter marks of 1st student : "))
marks.append(m7)
m8 = int(input("Enter marks of 1st student : "))
marks.append(m8)
marks.sort()
print(marks)