Python Programming Series (Loops 4): Nested loops

preview_player
Показать описание
A look at how to nest loops and an example of what can be done with when you do.

Рекомендации по теме
Комментарии
Автор

I've been working on this class assignment for my coding class for 2 days, should've taken no more than 15 minutes. Couldn't get the code to output the way expected. Your video basically helped me finally connect the dots on how to complete the assignment! Thank you!

joshuaf.
Автор

Awesome video. This really helped me learn nested loops. For anyone wondering how to print this triangle without using nested loops, here’s one approach:


i=8
for j in range(1, 17, 2):
print(i*" "+j*"*")
i=i-1

# i is the number of spaces, and j is the number of stars being printed, which goes down by 2 each row.

Honda-nnee
Автор

I was struggling with nested for loops, the range function and pattern printing until this video. I've watched several videos and this was the ah ha moment. Thanks.

papie
Автор

I had doubts for months about the shit for loop, I wish I watched this tutorial on my first programming day. Thank you bro

AMA_RILDO
Автор

Excellent visual presentation! Great voice. Thank you for using a large font. You are a good teacher.

basalduat
Автор

excellent explanation, I learned a lot as you went thru this step by step. Thank you.

myenjoyablehobbies
Автор

Excellent, Sir. I really liked your approach. It is unique and most logical. I can connect the dots after every steps .

satyajitdas
Автор

for i in range(6):
for j in range(0, 6-i):
print(' ', end="")
for k in range(0, 2*i):
print('0', end="")
print("0")

ntwaliobadiah
Автор

You taught us this in the best possible way

mehdighafari
Автор

Thank you very much, I was able to learn this subject better thanks to your help.

KenyiReyes
Автор

great video, appreciate the step-by-step thinking approach

abyazkarim
Автор

I have been to so many videos for understanding loops by far u are the best one . thanks pls keep up the good work I subscribed

sunnyveerpratapsingh
Автор

Great vid! I got this in 4 tries, but my code was a little cleaner just because I used a variable ('x') for the number of 0s printed:

x = 1 # number of 0s
for i in range(0, 7): # number of rows
for j in range(0, 7-i): # number of spaces over, starting with 7 but decreasing by 1 each time
print(' ', end = '')
print('0' * x) # number of zeros to print on each line
x += 2 # increment the number of zeros by 2 to get increasing, consecutive odd numbers for each row (1, 3, 5, ...)

dp
Автор

Thank you for explaining these concepts so well.

MSMEJanardhanMuralidhar
Автор

it was a nice, simple, and quick explanation, i understood it very quickly

danielbriller
Автор

Thank you for the great explanation, this really helped me intepret another project that was using different symbols. defintely gonna practise the pyramid for fun though.

bongajewelmsimang
Автор

Keep up the Good Work Mate! Understood the concept...Thanks!

ananthbyju
Автор

iv been trying to solve this for a day. Thank you so much

julianash
Автор

Clear and objective. Really good video, thank you man, it helped a lot! Liked and subscribed!!

deadbutt
Автор

How did you comment the piramide all at once? Seems like a usefull hotkey.

strat