Grocery = ["Tamato","Patato","Onion","Panner","Rice"] print(Grocery[2]) numbers=[1 ,78 , 24 ,98 ,57 ,34 ,843] print(numbers[2]) print(len(numbers)) print(max(numbers)) #It tells about the highest no. in function print(min(numbers)) #It tells about the smallest no. in function numbers.sort() numbers.reverse() print(numbers[0:]) print(numbers[:6]) print(numbers[::2]) print(numbers[::-1]) numbers.append(243) # append last ma eak no. add kr deta hai print(numbers) numbers.insert(2 , 87) #ye bhi no. add krta h , aap jha krvana chahe vha krta hai print(numbers) print(numbers) numbers.pop() #ye last vaale no. ko remove kar deti hai print(numbers) numbers[1] = 67 #ye no. ko replace kar ta hai print(numbers) # Mutable = can change , eg. List is Mutable because it can be change #Immutable = cannot change , eg. Tuple us Immutable because it can't change tp = (1 ,2 ,3) #tp[1] = 68 , Tuple is Immutable so it cannot be change #print(tp) tp=(1,) print(tp) # their output show only 1 that is not tuple , so we write tp=(1,) now there is coma(,) so it's output show (1,) that is tuple a = 21 b = 88 a, b = b , a print(a , b) #List Function in detail #Empty List = [] #list of integer list = [23 , 34 , 54 ,32 , 543 , 143 , 98] #List with mixed datatypes List=[2 , 3 , "akash" , 87 ,970 , "namahshivaye" ] # NESTED LIST LIST=["mouse" , [1 , 46 , 89] , ["akki"] , 23 ,87] print(LIST[1][2]) print(LIST[4]) #append() : Add list element as a value of list List1=[2 , 3 , "akash" , 87 ] List1.append("Mahadev") print(List1) #insert : Insert an element at specified position List1.insert(3,754) print(List1) #extend : Add content to list2 to the end of list1 List2=[4 , 5 , "namahshivaye" , 59] List1.extend(List2) # Adding List2 to List1 print(List1) List2.extend(List1) #Adding List1 to List2 print(List2) #sum() : Calculate sum of all elements of List list=[1,44 ,12 ] #It can not add an strimg like "akash" print(sum(list)) #count() : Calculate total occurrence of given element of list list1=[1,2,3,65,3,2,4,23,6,76,2,3] print(list1.count(2)) #len() : Calculates total length of List print(len(list1)) #del() : for deleting an element del list1[1] print(list1) #remove() : for removing an element by entering the element list1.remove(3) print(list1)