1.

8Considerlist1=[15, 25,35,40]Write the statement to perform the following:(i) Display maximum value from the given list.(ii) To remove the 2nd and 3rd element from the given list.​

Answer»

Given list:

list1 = [15, 25, 35, 40]

(i) To display the MAXIMUM VALUE from the list.

>>> max(list1)

(ii) To remove the 2nd and 3RD element from the list.

>>> del list1[1]

>>> del list1[3]

  • max() is a function that displays the maximum value in the specified argument. It needs to be noted that when using it with a list, the elements in the list must be of a uniform data type.
  • del is a function that DELETES an element from the specified argument.


Discussion

No Comment Found