Python 3 Programming Tutorial - For loop

preview_player
Показать описание
The next loop is the For loop. The idea of the for loop is to "iterate" through something. For each thing in that something, it will do a block of code. Most often, you will a for loop's structure very much like

for eachThing in thisThing:
do this stuff
in this block
So, again, why would someone use each type of loop?

Typically, you will see the while loop being used for finite tasks that have predetermined length, and the for loop being used for tasks that have uncertain and variable time-frames.

That said, the for loop can be used for the exact same tasks as the while loop.

For this reason, I prefer the for loop myself, but again, it comes down to personal preference.

This python 3 tutorial covers the for loop in python 3.3.3

Bitcoin donations: 1GV7srgR4NJx4vrk7avCmmVQQrqmv87ty6
Рекомендации по теме
Комментарии
Автор

you taught me more in 9 minutes than the last 6 weeks of class about loops. Thanks!

kodkid
Автор

dear youtuber. I wanna thank you for your time and dedication to creating this video. I am learning python and your video was precisely what i was looking for. thank you so much.

daveram
Автор

I have watched videos and done beginners courses till they’re 'coming out my ears’ and your videos are by far the best at introducing a complete beginner to a programming language. Thank you from the bottom of my heart. I was beginning to think I was an eedjit.

gabriellemoran
Автор

I'm a beginner python user who was so confused on for loops -you were so helpful in explaining even the small details like changing "for x in.." to "for eachNumber in.." since I had no idea what the variable x was indicating - now I know and everything else makes sense! On to the next video~

yuneecorn
Автор

I opted to follow along, and use words instead of numbers.
It helped me make mistakes, but I knew how to fix them given the last 5 lessons.

At first, I had an error, I forgot to quote. Second time, I quoted, but I quoted the whole list altogether, so it printed just one line, which was the list verbatim. Third-times the charm, I quoted them individually and it worked perfect.

I just want to let you know, your tutorials still work just fine in 2021, and I'll comment if anything pops up as I continue following them. Thanks for the effort.

Dr.Cosmar
Автор

These are the best tutorials even in 2019

ariaalex
Автор

This is EXACTLY What i was looking for! I was understanding EVERYTHING in python else than for loops, which u now thought me, Thanks for doing this for free, its really appriciated

llama-berry
Автор

quick question, why did you not need to write eachNumber = [1, 2, 3]. How did python understand you were talking about the exampleVar (sorry if i said something stupid i dont know how to code)

oliverizdebski
Автор

Damn, I am grateful that I came across your tutorials. Your playful way of teaching inspires me :)

thunderv
Автор

I literally watch your videos everytime before a quiz and I get straight 10/10

the.essentialist
Автор

sweet ive been poking through a bunch of for loop tutorials and still didnt understand it. your video was the only one that made sense and answered my questions! thanks 🙏🏻✨

xesiusprime
Автор

Thank you so much. I just started python for one of my classes and wish I had your video. You explained everything so clear.

architectman
Автор

You are a great teacher! I'm currently doing the python programming tech degree on team treehouse and when I need a little more breakdown on a certain subject just swing on over to your videos.

derikdavis
Автор

TheSunshinefee Good question. What happens is we're basically treating eachNumber as a temporary variable as we iterate through the list. Thus, eachNumber actually is being 'defined, ' and the definition is whatever part of the list we're at.

sentdex
Автор

for eachVideo in yourChannal :
print(Thanx)

samisri
Автор

wow... i m blownaway how you simplify everything. my inspiration is to teach programming the way you do...one day

kallowolfstag
Автор

Why are you not my professor? This video presentation is (whatever number that is) more useful than my lecture notes/videos. Thanks man!

ZulkarnainHafiz
Автор

Thanks for the amazing tutorial. For a Lv 1 Python programmer - Can't believe how wrong my interpretation was before I came here. Subscribed and Liked!

lawrencechiu
Автор

the thing about indentations in python is that once you've set an indentation (the first indentation), the next lines must be in the same indent or else it produces and error, the reason your code didnt give error is because both lines in the loop are with same indentation. (p.s im a beginner and my professor told me this, thought i'd mention it ) peace!!!!

zhann
Автор

I love how short the videos are and how you have separated everything.

DisgruntledVet