Answers for "python find which numbers sum to a total"

2

sum of any numbers in python

sum(list(map(int,input().split())))
Posted by: Guest on December-02-2020
0

sum of numbers in python

def sum_(n):
    if n == 0:
        return n
    else:
        prev_n = sum_(n - 1)
        result = prev_n + n
        return result


s = sum_(5)

print(s)

#Output:
# 15
Posted by: Guest on August-21-2021

Code answers related to "python find which numbers sum to a total"

Python Answers by Framework

Browse Popular Code Answers by Language