Exercises

  1. See the following list:
list1 = ["abc",[2,3,("mohit","the avengers")],1,2,3]

Get the string "avengers".

  1. With the for loop, take the following list and sort it based on the sum of the values of the tuples of the list:
[(1,5),(9,0),(12,3),(5,4),(13,6),(1,1)]
  1. Use the list, [1,2,4,5,1,1,4,1,56], and find the index of all the 1 elements.
  2. Do the preceding exercise by using list comprehension.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.146.34.146