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)


Expert's answer


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!

LATEST TUTORIALS
APPROVED BY CLIENTS