Trying to learn a new approach.
It's the classical problem of finding the sum of all multiples of 3 and 5 below 'n'.
What I want is:
print ("The sum is: ", sum(range(1, 100)))
But with an if-statement for multiples of 3 / 5.
My question:
How can I include that if-statement for a one-line solution?
Thanks for your help. =)
// Chris S.
Aucun commentaire:
Enregistrer un commentaire