I need to write a program using a loop ( while
) that receives two numbers as input, and can be positive or negative and not necessarily in ascending order, and the program should print the sum of all positive numbers in that range. I started the code by creating a list with all the values in the range, and I need to add the positive values. How to proceed? Is there a better way than creating a list?
a = int(raw_input())
b = int(raw_input())
if a < b:
a,b = b,a
if b < a:
a,b = b,a
y = range(a, b + 1)