Answer to Question #247183 in Python for ksimon

Question #247183

In this exercise, use the following <span style="text-decoration-line: none;">variables</span>: i,lo, hi, and result. Assume that lo and hi each are associated with an int and that result refers to 0.

Write a while loop that adds the integers from lo up through hi (inclusive), and associates the sum with result.

Your code should not change the values associated with lo and hi. Also, just use these <span style="text-decoration-line: none;">variables</span>: i,lohi, and result.



1
Expert's answer
2021-10-05T23:13:39-0400
lo = int(input(''))
hi = int(input(''))
result = 0
while lo <= hi:
    result = result + lo
    lo = lo + 1
5
9
result
35

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS