0

print(min(1, 2, 3, 4, 0, 2, 1)) print(max([1, 4, 9, 2, 5, 6, 8])) print(abs(-99)) print(abs(42)) print(sum([1, 2, 3, 4, 5]))

print(sum([1,2,3,4,5])) ,why sum enclosed in brace??

25th Aug 2019, 12:52 PM
Rupal Raut
4 Réponses
+ 2
Sum only takes an iterable, max for example can take an iterable or individual elements/arguments.
25th Aug 2019, 1:41 PM
rodwynnejones
rodwynnejones - avatar
+ 1
The count of parentheses between min and sum are the same.
25th Aug 2019, 12:55 PM
HonFu
HonFu - avatar
+ 1
" Sum() " is a function . And you have to find sum of list of numbers , so you give list of numbers in sum function
26th Aug 2019, 2:03 AM
V.K.n.ganesh
V.K.n.ganesh - avatar