Nested loops in Python are easy ➿
Vložit
- čas přidán 25. 10. 2022
- #Python #course #tutorial
nested loop = A loop within another loop (outer, inner)
outer loop:
inner loop:
rows = int(input("Enter the # of rows: "))
columns = int(input("Enter the # of columns: "))
symbol = input("Enter a symbol to use: ")
for x in range(rows):
for y in range(columns):
print(symbol, end="")
print()
# nested loop = A loop within another loop (outer, inner)
# outer loop:
# inner loop:
rows = int(input("Enter the # of rows: "))
columns = int(input("Enter the # of columns: "))
symbol = input("Enter a symbol to use: ")
for x in range(rows):
for y in range(columns):
print(symbol, end="")
print()
You're my hero... Love from South Africa :)
I don't know why but my brain really, REALLY wants to overthink both for loops and nested loops. They're really simple concepts but something always gets wonky in the monkey wires. This was a great video, really needed something to explain it in the most babymode 5 year old way, thank you
Same happens to me
Its a completely opposite for me tho i need more in depth explanation
I thought I was the only one
Yeah me too😢
Same condition for everyone else. No one just realises it
Bro, you saved me ass, I was gonna fail for sure but you absolute ultimate gigachad saved my. Thank you King. You dropped this 👑
Thank you much
This is the first time I have understood nested loops, pattern after watching so many videos
God bless
Please keep making more videos on programming
THAT IS SO WELL THOUGHT OUT! BRILLIANT! AND I AM STARTING TO UNDERTAND HOW PROGRAMMERS THINK AND DEVELOP THEIR PROGRAMS! THANK YOU SO MUCH FOR ALL YOUR TUTORIALS!
U are the best🥲, u are supposed to be a lecture😏
This is very clever and give me a better understanding in nested loop
Perfectly explained, thank you!
You’re awesome man! Thanks
Thanks bro, you explain them really well
You entirely clear my concept ... thanks alot bro 😭😭🤌
Thank so very much for your help on leaning Python .. Great, to the point Teacher.
Such a beautiful explanation Sir. Thanks a lot for sharing making it easy to understand for beginners.
Thank you bro for all your videos. I Iearnt java and javascript extensively through your videos.
Very clearly explained bro! Thanks!
Thank you so much for this
Thanks for the wonderful video...
clear explanation, helped and saved my brain from overthinking
awesome content as always, thanks Bro!👌
Thank you sir for your help..
Brilliant. Thank you.
Bro, may I say you have such a soothing and beautiful voice? 🤗
Now I understand nexted loop better👏✔️
thanks for your explanation it's really helpful ☺
Thank you so much sir
THANK YOU SO MUCH
excellent vid. really well explained. thanks
very helpful thanks
Thanks 😊
Thanks for the explanation really needed it I was literally going mad trying to understand it on my own not know that it is not that deep
man i love you thx
I have my a levels computer science exam tomorrow and you just saved my life
Thank you❤
you're awesome
You are the best!!!!!
I have watched multiple videos, trying to understand nested loops and this video finally made sense to me! Thanks for breaking this down in such an easy way.
Wow !! super expalination !@
Really loved the explanations, thanks! One question, how would the code look like if I wanted to make a triangle tho?
Good job 👍
Thx 4 vid bro !
This is a life saver video I have my exam tomorrow so thank u so much
v v good. ty ❤
First semester CS student. Nested loops confused the hell out of me in class last week. This video helped clear some of the confusion. Much appreciated!
Also a first semester CS student, was totally lost. Hoping this video helps. Will watch when I get home from my lecture.
took me about an hour but finally I understand nested loops, thank you Bro Code
3 days now, still dont fully understand it
@@user-th2js2nv3f take your time, what worked for me was writing it on a whiteboard, and trying to explain it with my own words, if you think about it it's like multiplication:
For n in range(3)
For z in range(5)
Print("hello")
The first for loop will tell you how many times the next loop will be done, in this case 3, and then the second loop, will print 5 "hello":
Hello hello hello hello hello
Hello hello hello hello hello
Hello hello hello hello hello
You printed 5 hello's, 3 times
@@klliope that´s actually a pretty good. thx man
@@klliope Buddy to print what you wrote:
for i in range(3):
for k in range(5):
print("hello", end="")
print()
Hope yer fine.
Thank you
Very well explained, thank you!
you are the best
Thx bro for the good explanation I have an exam tomorrow and I didn’t understand nested loops bcz the explanation in the digital book that the school gave me was CONFUSING AND COMPLICATED
Very nice
Tq so much
I finally see the light!😀
damn ur awesome
this guy tptally sounds like ryan george from pitch meeting , also thanks for your video made a complex topic so simple
respect Teacher.
@Bro Code
do you have a matrix done ? That would be great !
haha, valeu amigo.
Estou fazendo um curso qui no Brasil usam essa refêrencia para ensinar for in range.
Vou ver mais aulas, não compreendo inglês, mas entendo o código.
Hey bro I'm new to python, I just want to kick start my career I'm 23 now, is it ok to learn python from basics., Bcz I feel aged for programming..
It’s never too late
thnx , with anki flashcards would be cool to memorize
Hey Bro code, do you have an example of a text based game in python??
I didn't like the appearance of having a period after the last number in the iteration, so I wanted to change how it looks. But I also wanted to avoid hard-coding it to be the exact number '9'. Here is the solution I came up with, using the str.join() method:
for x in range(3):
sequence = range(1, 10)
last_number = list(sequence)[-1]
numbers = [str(y) if y != last_number else str(y) for y in sequence]
print(".".join(numbers))
Can u make it in one line please?
Thank You make it simple bro codez
❤❤😊😊
Bro saved me from failing in my class 11th practical exams 🙏🏽🙏🏽🙃
sir how can I use this expression in python for nested loops? val= int(input()) inputs are 2 and 5. and output should be * mark as rectangle shape. Please explain. Thank you.
after first loop can we write print(symbol * columns ) and finish the code ?
So I'm doing exactly this but for some reason it's shorting me a symbol at the end.
Bro can you make a Kotlin tutorial?
I crash course your Java andddddd employers seeks Kotlin....
My thing and im in my 3rd werk for python is when I'm reading or watching this material i understand it, but i have an issue seeifn where you use it. Maybe this comes along once you understand all the fundamentals concretely bc i sure as hell don't yet. But this leads to massive overthinking on my part.
Like, i have a simple site written in simple html/css. I have made a database in docker with MSSQL, and i want to make a python application to get the data from the DB and display it on the webpage. In very generic terms this is the "stack" im looking for no?
Chad 🗿 explanation
Can you make a tutorial how to delete system32 with python ?
no lol
@@BroCodez Ok =l
can someone tell me how to get this type of window in python with the program result at the bottom
Wher full rust tutorial
Which app do u use to program?
PyCharm
hello bro, hope you're doing well
Make sense
bro which idle do u use
Pycharm
tini paduko
Arigatō aniki!
a loop inside of an another loop outer loop inner loop
end="/t"
Will make your result like a table
I think you mean \t
i think you mistaken row for column and column for row
its feels like i a
X is a counter. What is a counter?
Watch the video on for loops
Loop de loop
can you please explain this question
Ask the users favorite color and if it is a rainbow color print the color two times and if the color is not a rainbow color print all the even numbers before the birthdate of the user
what does the 'end' command do?
Your comment is a month old but if you have not yet figured it out (or if someone else is reading your comment and wondering the same thing: it tells the program to print all the numbers on the same line:
1234567
1234567
1234567
Otherwise it would put each number on a new line
1
2
3
4
5
6
7
1
2
3
4
5
6
7
1
2
3
4
5
6
7
And if you would put a space between the parentheses it will put a space between the numbers: 1 2 3 4 5 6 7
You can just experiment with what happens when you do not put the ,end=" " there then you will see
@@fuzzylogics139 Thank you bro before that i had a vague idea what it did now its clear
Great! :) @@tauhidalam-8143
this just doesnt click with me at all, this is the hardest concept so far. im hitting a wall and its only week 3. fml
The outside loop indicates how many times we do the inside loop.
Same I understand it on paper but once I try to do anything I get confused
4:54
That’s not a rectangle
dont get it
a = int(input("Enter the # of rows: "))
b = int(input("Enter the # of columns: "))
symbol = input("Enter a symbol to use: ")
for i in range(a):
print(symbol*b, end="
")
Comment
Inside a comment
Nested comment
bro
comment
in the comment
@@piotrkopcewicz5227 nested comment
easy? i got 10/20 tho