Answer to Question #302730 in Python for Lokesh

Question #302730

Math Quiz


Write a program to print the following,


Sample Input 1

1 3 4 5 6

5

3 5

Sample Output1

12


1
Expert's answer
2022-02-28T10:57:07-0500
I = str(input("Enter numbers separated by space: "))
I = I.split(" ")
a = int(input("Enter lower range: "))
b = int(input("Enter upper range: "))


Sum =0
for r in range(0,len(I)):
    if(int(I[r])>=a and int(I[r])<=b):
        Sum = Sum + int(I[r])
print("Sum = ",Sum)



Python Output:

Enter numbers separated by space: 1 2 3 4 5

Enter lower range: 3

Enter upper range: 5

Sum = 12

>>> 


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