0
need help
Write a function that accepts two integers (a,b), it should sum up all the numbers from a to b (inclusive of a and b) and then return the sum divided by 2 as a float. Examples: Input a=2, b=5 Output: 7.0 Input a=7, b=9 Output: 12.0 Starting code: def looping_sum(a: int, b: int): sum=0 #enter code here print(looping_sum(2,5)) print(looping_sum(7,9)
1 Answer
+ 3
What type of help you need there?
What you tried so far to solve it?
Use a loop repeat from a to b+1 , add value to sum , return sum after loop.