SimplyMiah

Hello Repel community,
I am stuck on a CodeHS question titled: Better Sum. Can you guys please help me with this, it means the world to me, thank you <3
Here is the problem :)

Write a program that asks the user for two numbers. Using a for loop, add all of the numbers from the first to the second.
For example if the first number is 6 and the second number is 8 the result is 21 (6 + 7 + 8).
Print out the results when you are finished.

You are viewing a single comment. View All
Bookie0

@SimplyMiah well if you use the code I just shared with you below

```.css-o0gntx{position:absolute;left:-9999px;}.css-4kcfpn{-webkit-align-items:stretch;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;border-width:0;border-style:solid;box-sizing:border-box;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-basis:auto;-ms-flex-preferred-size:auto;flex-basis:auto;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;outline:none;min-height:0;min-width:0;position:absolute;left:-9999px;}a = input("") # 1st number
b = input("") # 2nd number

c = b - a # how much times loop goes
for i in range(c):
sum += a # makes the sum
a += 1 # for getting the numbers in between

print(sum + b)```

it wouldnt need any change, it would work just fine ;)