0

Sum python

n = int(input(„number“)) for i in range(1, n): If i%3 == 0 or i%5 == 0: Print(i) How do i take the sum over the output print(i)?

3rd Mar 2019, 7:17 PM
vicky
4 Risposte
+ 1
Maybe you need this if I guess it right. Hope it helps you. https://code.sololearn.com/cVGt74J9ctxb/?ref=app
3rd Mar 2019, 7:31 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
0
print(sum(i for i in range(1,int(input())) if i%3==0 or i%5==0))
3rd Mar 2019, 8:58 PM
Diego
Diego - avatar
0
TheWhiteCat💡 thank you very much!!
3rd Mar 2019, 10:39 PM
vicky
0
vicky you are welcome 😉
4th Mar 2019, 8:25 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
Popolare oggi
.
1 Votes
What?
0 Votes
HTML
0 Votes
FRC Coding?
1 Votes
Quiz duel
0 Votes
AI
2 Votes
help
0 Votes
APIs
1 Votes
Create Agent
0 Votes