Python calculates the sum of 1 to N through a while loop

From , 3 Years ago, written in Python, viewed 88 times.
URL https://pastebin.vip/view/48b454e5
  1. def sum(n):
  2.     result = 0
  3.     i = 1
  4.     while i <= n:
  5.         result += i
  6.         i += 1
  7.     return result

Reply to "Python calculates the sum of 1 to N through a while loop"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website