For loops Python tutorial.

This entire series in a playlist:

Keep in touch on Facebook:

Download the sample file:

Subscribe to my newsletter:

Support me on Patreon:

source

Add to favorites

For loops Python tutorial.

This entire series in a playlist:

Keep in touch on Facebook:

Download the sample file:

Subscribe to my newsletter:

Support me on Patreon:

source

Yan Qing ZhangNovember 15, 2019 at 11:58 pmI got 315

SpicyCoralNovember 15, 2019 at 11:58 pmyou need to remove duplicate multipul that are in the same time multipul 3 and 5 to dont have dupplicate value

m1=0

for i in range(1,100):

if i % 3== 0 or i % 5 == 0:

m1 += i

m2= 0

if i % 3== 0 and i % 5 == 0:

m2 += i

total= m1 – m2

print(total)

2003

Vishnu PriyaNovember 15, 2019 at 11:58 pmtotal = 0

for i in range (1,100):

if i%3 ==0 or i%5 == 0:

total += i

print (total)

ans = 2318

Egon SpenglerNovember 15, 2019 at 11:58 pmIf anyone else is having a hard time keeping up, i set the playback speed to 75% and it made it easier to follow. 😉

Egon SpenglerNovember 15, 2019 at 11:58 pmI think my brain might be to dumb for this. LOL. I was following pretty okay up to this lesson, then it just left me in the dust. I need coding lessons aimed for 5 year olds. haha. And I'm 38!

nilay kanakiaNovember 15, 2019 at 11:58 pmtotal4 = 0

for i in range (1, 100):

if i % 3 == 0 or i % 5 == 0

total4 += i

print(total4)

eli eliNovember 15, 2019 at 11:58 pma=list(range(0,100))

total=0

for i in a:

if i%3==0 or i%5==0:

total+= i

print(total)

Al MamunNovember 15, 2019 at 11:58 pmdata=list(range(1,100))

print(data)

total=0

for i in data:

if i%3==0 and i%5==0:

total+=i

print(i)

print(total)

I AM HARSHNovember 15, 2019 at 11:58 pmtotal = 0

range(1, 100)

for m in range(1, 100):

if m % 3 == 0 and m % 5 == 0:

total += m

print(total)

Ethan NguyenNovember 15, 2019 at 11:58 pmwhy do we have to use the total variable to find the sum? Wouldn't the command "sum" do the same job?

Jye CassidyNovember 15, 2019 at 11:58 pmtotal4 = 0

for a in range(1,100):

if a % 3 == 0 or a % 5 == 0:

total4 += a

print(total4)

Thumbs up if right

MuxTubeNovember 15, 2019 at 11:58 pmThat is bit complex

total2 = 0

for i in range(1, 5):

total2+=i

print(total2)

result

1

3

6

10

Why it is not giving only 10?

Benjamin HammondNovember 15, 2019 at 11:58 pmtotal=0

for i in range(1, 100):

if i % 3 == 0:

total += i

elif i % 5 == 0:

total += i

print(total)

2318

Shubhangi ZadeNovember 15, 2019 at 11:58 pmI got 2633

ALHAJICM KALLONNovember 15, 2019 at 11:58 pmI got 1683

Joel KyeNovember 15, 2019 at 11:58 pmin addition to totaling multiples of 3 and 5 I wrote the following code lines to deduct multiples of 15,

if E1 % 15 == 0:

#deduct multiples of 15

total4 -= E1

Andrew Sinclair-GunnNovember 15, 2019 at 11:58 pmGreat tutorial, though I did find the challenge a bit ambiguous as I wasn't sure if I should count the values divisible by both 3 and 5 twice or just once (e.g. 15 % 3 = 0 and 15 % 5 = 0). So I did both 🙂

total4 = 0

total5 = 0

for i in range(1,100):

if (i% 3 == 0) or (i % 5 == 0):

total4 += 1

print("unique = " + str(total4))

for i in range(1,100):

if (i % 3 == 0):

total5 += 1

if (i% 5 == 0):

total5 += 1

print("total = " + str(total5))

Berman Ramadhan ChannelNovember 15, 2019 at 11:58 pmsomeone please tell me what for is

Master1001November 15, 2019 at 11:58 pmFantastic Tutorials in every aspect. Thanks for making them!

Ram krishna namdevNovember 15, 2019 at 11:58 pm# to sum up all integers which are multiples of 3 or 5 and less than 16

total4 = 0

for z in range (1, 16):

if (z % 3) == 0 or (z % 5) == 0:

total4 += z

print (total4)

it gives 60

# to sum up all integers which are multiples of 3 or 5 and less than 100

total4 = 0

for z in range (1, 100):

if (z % 3) == 0 or (z % 5) == 0:

total4 += z

print (total4)

it gives 2318