Answers for "can't use sum(list) in a function"

16

python sum of list

>>> list = [1, 2, 3]
>>> sum(list)
6
Posted by: Guest on January-27-2020
-1

how to do the sum of list in python

def calculate_cards(cards):
    total= 0
    for card in cards:
        total = total + card
    return total
print(calculate_cards([11,7,5]))
Posted by: Guest on August-27-2021

Code answers related to "can't use sum(list) in a function"

Python Answers by Framework

Browse Popular Code Answers by Language