How do I make a whileloop that gives me the sum of the multiples of 3 until a number


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>

<What do you expect to happen instead?>

```python

Replace this line with your code.

<do not remove the three backticks above>

#2
m = 30
n = 0
while True:
    if n + 3 > m: break
    n += 3

That takes care of multiples. Now the sum.

m = 30
n = 0
s = 0
while True:
    n += 3
    s += n
    print ('*' * n)
    if n + 3 > m: break
  
print (n, s)
***
******
*********
************
***************
******************
*********************
************************
***************************
******************************
30 165

https://repl.it/Lye9/2


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.