Answer to Question #196877 in Python for Jenny

Question #196877

Take an even number between 10 and 50 from the user as input. Calculate the sum of all numbers from 1 till the input number. Make sure the necessary are checks are placed for while taking input.


1
Expert's answer
2021-05-23T08:04:26-0400
n = int(input())
if 10 <=n <= 50 and n%2 == 0:
    s = 0
    for i in range(1, n+1):
        s += i
    print(s)

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