Skip to content

Instantly share code, notes, and snippets.

@nitstorm
Created December 31, 2013 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nitstorm/8201516 to your computer and use it in GitHub Desktop.
Save nitstorm/8201516 to your computer and use it in GitHub Desktop.
Summation and Double Summation examples for the Loops post @ http://nitstorm.github.io/blog/
x = int(input("Enter x upper limit:"))
y = int(input("Enter y upper limit:"))
total = 0
i,j = 1,1
while i <= y:
while j <= x:
total = total + (x*y)
j += 1
i += 1
print total
total = 0
for n in range(1,100):
total = total + (2*n)
print total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment