Computer Science
Do functions max( ), min( ), sum( ) work with all types of lists.
Python List Manipulation
36 Likes
Answer
No, for max() and min() to work on a list, the list must contain all elements of same type (non-complex type) and for sum() to work, the list must contain the elements which can be added such as numbers.
Answered By
19 Likes
Related Questions
An index out of bounds given with a list name causes error, but not with list slices. Why?
What is the difference between appending a list and extending a list?
What is the difference between sort( ) and sorted( )?
What is the difference between following two expressions, if lst is given as [1, 3, 5]
(i) lst * 3 and lst *= 3
(ii) lst + 3 and lst += [3]