Skip to content

Instantly share code, notes, and snippets.

@gilrg18
Created March 3, 2015 01:30
Show Gist options
  • Save gilrg18/d44ef75afa645e2ae1e8 to your computer and use it in GitHub Desktop.
Save gilrg18/d44ef75afa645e2ae1e8 to your computer and use it in GitHub Desktop.
wsq07.py
print("We will calculate the sum of integers in the range you provide")
result= 0
num1=int(input("Please give us the lower bound:"))
num2=int(input("Please give us the upper bound:"))
while num1>num2:
print ("User input error, please give us the numbers again")
num1=int(input("Please give us the lower bound:"))
num2=int(input("Please give us the upper bound:"))
while num1<num2 :
result=result + num1
num1=num1+1
result=result+num1
print ("The sum from your lower bound to your upper bound is",result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment