Skip to content

Commit

Permalink
sum of all numbers (the-vampiire#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamsdas authored and the-vampiire committed Oct 8, 2019
1 parent 105eaf5 commit e0cf800
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions python/beginner/sum_of_all_numbers_suryashankardas.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
input_list = []
for i in range(2):
input_list.append(int(input("enter no: ")))


def sum_all(a):
if a[0] > a[1]:
a[0], a[1] = a[1], a[0]
sum = 0
for n in range(a[0], a[1] + 1):
sum += n
return sum


print(sum_all(input_list))

0 comments on commit e0cf800

Please sign in to comment.