25 solutions available
Question 19Which of the following can add only one value to a list?add( )append( )extend( )none of these
Question 23Which of the following can delete an element from a list, if its value is given?pop( )remove( )delall of these
Question 24Which of the following searches for an element in a list and returns its index?search( )find( )index( )lsearch( )
Question 25Which of the following can copy a list to another list?list( )new( )copy( )= operator
Question 2What do you understand by mutability? What does "in place" memory updation mean?
Question 4If a is [1, 2, 3]what is the difference (if any) between a * 3 and [a, a, a]?is a * 3 equivalent to a + a + a?what is the meaning of a[1:1]...
Question 8What's the purpose of the del operator and pop method? Try deleting a slice.
Question 9What does each of the following expressions evaluate to? Suppose that L is the list["These", ["are", "a", "few", "words"], "that", "we",...
Question 10What are list slices? What for can you use them?
Question 13What do you understand by true copy of a list? How is it different from shallow copy?
Question 17What is the difference between sort( ) and sorted( )?
Question 7Predict the output:my_list= [ 'p', 'r', 'o', 'b', 'l' , 'e', 'm'] my_list[2:3] = [] print(my_list) my_list[2:5] = [] print(my_list)
Question 11Predict the output of following two parts. Are the outputs same? Are the outputs different? Why?(a)L1, L2 = [2, 4] , [2, 4] L3 = L2...
Question 18Consider the following code and predict the result of the following statements.bieber = ['om', 'nom', 'nom'] counts = [1, 2, 3] nums =...
Question 19What is the output of the following code?numbers = list(range(0, 51, 4)) results = [] for number in numbers: if not number % 3:...
Question 20Following code prints the given list in ascending order. Modify the code so that the elements are printed in the reverse order of the...
Question 1Write a program to increment the elements of a list with a number.Solutionlst = eval(input("Enter a list: ")) print("Existing list is:",...
Question 3Write a program that inputs two lists and creates a third, that contains all elements of the first followed by all elements of the...
Question 5Ask the user to enter a list of strings. Create a new list that consists of those strings with their first characters removed.Solutionl1 =...
Question 6Write a program to check if a number is present in the list or not. If the number is present, print the position of the number. Print an...
Question 10Write a program that reads the n to display nth term of Fibonacci series.The Fibonacci sequence works as follows:element 0 has the value...
Question 11bWrite programs as per following specifications:'''L is a list of numbers. Print a new list where each element is the corresponding...
Question 12Write a program to read two lists num and denum which contain the numerators and denominators of same fractions at the respective indexes....
Question 13Write a program to display the maximum and minimum values from the specified range of indexes of list.Solutionl = eval(input("Enter the...
Question 15Write a program to compare two equal sized lists and print the first index where they differ.Solutionprint("Enter two equal sized lists")...