8
Consider
list1=[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.
Answers
Answered by
14
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.
Similar questions