def sum(*args) -> int: black_list = [str(type("")), str(type({}))] sum_of_args = 0 for i in args: if str(type(i)) in black_list: exit(1) else: if str(type(i)) == str(type([])): for k in range(len(i)): sum_of_args += i[k] else: sum_of_args += i return sum_of_args
def sum(arr):var = 0for i in arr:var += ireturn var- def sum(*args) -> int:
- black_list = [str(type("")), str(type({}))]
- sum_of_args = 0
- for i in args:
- if str(type(i)) in black_list:
- exit(1)
- else:
- if str(type(i)) == str(type([])):
- for k in range(len(i)):
- sum_of_args += i[k]
- else:
- sum_of_args += i
- return sum_of_args