Write a program which should change all the multiples of 5 in the list to 5 and rest of the elements as 0. l=[1,2,3,4] for i in l: if(i%5==0): l[i]=5 else: l[i]=0 #------------------------------------------------- Write a program in python, which should change all the odd numbers in the list to 1 and even numbers as 0. l=[11,12,13,14] for i in range(len(l)): if(i%2==0): l[i]=0 else: l[i]=1 print(l) #--------------------------------------------------- Write a program in python, to add 5 in all the odd values and 10 in all the even values of the list 5. l=[11,12,13,14] for i in range(len(l)): if(i%2==0): l[i]=l[i]+5 else: l[i]=l[i]+10 print(l) #------------------------------------------------------------------------------- #Write a program to find the position of max element L=[14, 25, 68, 90, 65] t=L.index(max(L)) print("position of maximum value",t+1) OR L=[] n=int(input("how many elements u want to enter")) for i in range(n): t=int(input("enter elements")) L.append(t) print("my list is ",L) t=L.index(max(L)) print("position of maximum value",t+1) ''' #--------------------------------------------------- Write a program to delete /remove all the numbers less than 10 form the list. A=[33,4,5,66,7,88,90] d=[] for i in A: if(i>10): d.append(i) print(d) #------------------------------------------------------------------------- Write a program to delete /remove all the odd numbers form the list. A=[33,4,5,66,7,88,90] for i in A: if(i%2!=0): A.remove(i) print(A) #------------------------------------------------------------------------- Write a code in python which replaces elements having odd values with thrice its value and elements having even values with twice its value. Example : if an list of five elements initially contains elements as 3, 4, 5, 16, 9 rearrange the content of the list as 9, 8, 15, 32,27 Ans: A=[33,4,5,66,7,88,90] for i in A: if(i%2!=0): print(i*3,end=" ") else: print(i*2,end=" ") #---------------------------------------------------------------------------- Write a code in python which rearranges the list in reverse. Example: If an list of nine elements initially contains the elements as 4, 2, 5, 1,6, 7, 8, 12, 10 rearrange the list as 10, 12, 8, 7, 6, 1, 5, 2, 4 sol a=[4,2,5,1,6,7,8,12,10] a.reverse() print(a) #--------------------------------------------------- Write a code in python and swap the elements of every even location with its following odd location. Example : If an list of nine elements initially contains the elements as 2,4,1,6,5,7,9,23,10 rearranges the list as as 4,2,6,1,7,5,23,9,10 sol: A=[2,4,1,6,5,7,9,23,10] for i in range(0,len(A)-1,2): A[i],A[i+1]=A[i+1],A[i] print(A) #--------------------------------------- ''' Write a code in python which transfer the content from one list ALL[ ] to two list Odd[ ]and Even[]. The Even should contain values from places (0,2,4,………) of ALL[] and Odd[] should contain values from places ( 1,3,5,……….). ''' even=[] odd=[] A=[3,4,56,76,8,98,23,76] for i in range(0,len(A)-1): if(i%2==0): even.append(A[i]) else: odd.append(A[i]) print("even list",even) print("odd list",odd)