#TC1014 #WSQ07 Sum of Numbers

I had already done something like this in Introduccion ala computación class in c# so it wasnt a problem for me to do it again in python…i think python is easier because i dont have to use these things { } 

Here’s my code

Rogel García A01630171

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)

CC BY 4.0 #TC1014 #WSQ07 Sum of Numbers by Gilberto Rogel García is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.