Skip to content

Commit

Permalink
Update sum-of-all-numbers-gettaplay.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Thangamgm2000 authored Oct 13, 2018
1 parent 0a01dce commit 55c4be8
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions beginner/sum-of-all-numbers-gettaplay.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
def sum_all(li):
sum = 0
start = min(li)
stop = max(li)
for i in range(start,stop+1):
sum += i
return sum

a=min(li)
b=max(li)
n=b-a+1
return (n*(a+b)/2)
print(sum_all([1,4]))
print(sum_all([4,1]))
print(sum_all([4,1]))
print(sum_all([10,15]))

0 comments on commit 55c4be8

Please sign in to comment.