Answers for "python sum of one integer"

7

sum of 2 numbers in python

a = int(input("Enter first number:"))
b = int(input("Enter second number:"))
sum = a+b
print(sum)
Posted by: Guest on March-06-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 sum of one integer"

Python Answers by Framework

Browse Popular Code Answers by Language