#WSQ07 – Sum of Numbers

This program will sum all the integers in a range provided by the user(low and high).

But the thing gets more intersting when you add a condition, what if the user enter the range flipped. My solution was simple, using another variable(joker) to keep rolling the values of the variables until the boundries are flipped.

2016-02-19

Also used a counter and a while loop, because you start at the lower value(once you flipped if needed) and you know that the point to stop will be de upper value, so you just keep to adding 1 to the lower value and keep adding it to the same lower value.

2016-02-19 (1)

At the end joker is equal to lower, because you need the original value of lower if you want to display to the user, just to remaind them, the range they provide.

code: https://www.dropbox.com/s/3yo77oervelor5x/wsq7-ran.py?dl=0

#TC101

CC BY-SA 4.0 #WSQ07 – Sum of Numbers by programmingtc101 is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.