282
contributi
Nessun oggetto della modifica |
Nessun oggetto della modifica |
||
Riga 1: | Riga 1: | ||
{{Template:Acc_Menu_Python}} | |||
If we list all the natural numbers below 10 that are multiples of 3 or 5, | |||
we get 3, 5, 6 and 9. The sum of these multiples is 23. | we get 3, 5, 6 and 9. The sum of these multiples is 23. | ||
Find the sum of all the multiples of 3 or 5 below 1000. | Find the sum of all the multiples of 3 or 5 below 1000. | ||
<pre> | |||
def multiple(multiple,value): | def multiple(multiple,value): | ||
multiples = [] | multiples = [] | ||
Riga 19: | Riga 19: | ||
return sum_of_numbers | return sum_of_numbers | ||
if __name__ == '__main__': | if __name__ == '__main__': | ||
somma = 0 | somma = 0 | ||
Riga 34: | Riga 32: | ||
valore = int(input('value: ')) | valore = int(input('value: ')) | ||
print(multiple(multiplo,valore)) | print(multiple(multiplo,valore)) | ||
</pre> |
contributi