My question is related to the sum function in python.
So my code is
def black_jack(a, b):
if sum(a, b) > 21:
return 0
else:
sum is builtin function, look at the documentation:
In [1]: sum?
Docstring:
sum(sequence[, start]) -> value
Return the sum of a sequence of numbers (NOT strings) plus the value
of parameter 'start' (which defaults to 0). When the sequence is
empty, return start.
Type: builtin_function_or_method
so you need to pass it a iterable! :
solution1
sum([a, b]) #list
solution2
sum((a, b)) #tuple