Answer to Question #302309 in Python for reyadhh

Question #302309

Ask the user to enter a Number, N

Display the summation of multiples of 7 up to that number (from 1 to N inclusive)


1
Expert's answer
2022-02-25T03:40:18-0500


user = input('Enter a number N ')

n = int(user)


multiples = [i for i in range(1, n+1) if i % 7 ==0 ]

print(sum(multiples))


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