-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path09.py
More file actions
35 lines (33 loc) · 1.09 KB
/
Copy path09.py
File metadata and controls
35 lines (33 loc) · 1.09 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
# numbers.extend(grocery) # it can add 2 list
grocery = ["Harpic", "vim bar", "deodrant", "doreamon", "lollypop", "56", 90]
# print(grocery[5])
numbers = [2, 7, 9, 11, 3]
# numbers = []
# numbers.sort() #it can arrange the list in increasing order
# numbers.reverse() #it can reverse the list
# print(numbers[1:5:2])
# print(len(numbers)) #count the no. of element in the list
# print(min(numbers)) # find the smallest element in the list
# print(max(numbers)) # find the largest element in the list
# numbers.append(7)
# numbers.append(78)
# numbers.append(4) # add element in the list
# numbers.insert(2, 90) #add element in the list at spesific position
# numbers.remove(9) #remove element from the the list
# numbers.pop() #remove last element in the list
# numbers.copy()
print(numbers)
# numbers[1] = 98 #we can change the element by this
# print(numbers)
# Mutable - can change ex. list
# Inmutable - cannot change ex. tuple
# a = (1,)
# print(a)
# print(type(a))
# a = 1
# b = 8
# a, b = b, a
# temp = a
# a = b
# b = temp
# print(a, b)