Why this code needs square bracket ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why this code needs square bracket ?

In line 7 it seems to have square bracket , why ?? why max and min doesn't need but sum needs it ? https://code.sololearn.com/c3W1YtbchZs5/?ref=app

2nd Feb 2018, 10:05 PM
NIMA
NIMA - avatar
1 Answer
+ 6
take a look at the min/max and sum functions in this page: https://docs.python.org/3/library/functions.html sum takes two arguments at most first one is an iterable (list, tuple, etc...) and initial value min/max however is more flexible than that it can either take in an iterable, or two or more arguments
2nd Feb 2018, 10:20 PM
Burey
Burey - avatar