Ask the user to enter a Number, N
Display the summation of multiples of 7 up to that number (from 1 to N inclusive)
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?
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Comments
Leave a comment