For Loops & While Loops in Python - Beginner Python Tutorial #5 (with Exercises)

preview_player
Показать описание
Fifth video in my python tutorial series. In this video we cover the two different types of loops, for & while loops. Loops allow you to repeatedly execute blocks of code. For loops work great for a set number of iterations as well as iterating through lists. While loops work well with booleans (true or false).

If you have any questions, leave a comment down below!

Feel free to watch on 1.25x or 1.5x speed.

SUBSCRIBE if you enjoyed this video!! More tutorials to be uploaded real soon.

-------------------------
PYTHON TUTORIAL SERIES:

-------------------------
Follow me on social media!

-------------------------

*I use affiliate links on the products that I recommend. I may earn a purchase commission or a referral bonus from the usage of these links.
Рекомендации по теме
Комментарии
Автор

Video Outline!
1:09 - Intro to For Loops
2:09 - Getting Iteration Number
4:10 - For Loops + Lists
5:31 - Calculating the average value in a list
10:21 - For Loops + Lists (index method)
12:33 - Using the Enumerate function
13:27 - Intro to While Loops
15:02 - Counting to 10 with While loop
18:18 - Break & Continue Statements
21:17 - Coding Bat Example Problems
24:53 - Coding Bat Example #2
30:33 - Video Recap

Feel free to watch on 1.25x or 1.5x speed to learn faster!

KeithGalli
Автор

man, honestly you are the coolest programmer. I will start enjoy watching your python and NN videos systematically.

cambridgebreaths
Автор

where were you 4 months ago when I statrted teaching myself python.. you are the man bro.. thanks

Yordani
Автор

It's my first time here but i liked you the first minute the video started and the second you started talking. I don't think I am going anywhere.

meliyomollameles
Автор

you just helped me after being stuck for 2 hrs on this while loop.

TheFreeballer
Автор

I used to program in C/C++ using the Windows APi (Petzold book) and it was a complicated process!! Python is so much easier!! Thank you for these tutorials!!

fosback
Автор

Thanks. I always learn something new watching your videos.

Pythagoras
Автор

Hey, Keith. Great video as always! Could you make another one regarding the nested for loops (for loops in for loops) and nested if statements (if statement in if statement)? Stay safe!

sylvesterkanev
Автор

i = 2
n = 1

while n <10:

print(i)

i *= i

this is cool

martinopranjic
Автор

24:41 For whatever reason this works too...
def array123(nums):
if 1 and 2 and 3 in nums:
return True
else:
return False

Youuuuuu
Автор

Keith your videos a very easy to understand, So helpful Thanks..

brianwake
Автор

Love your tutorials, easy to follow and good content for beginners. Short question on the Codebat "String_time": did you use the loop intentionally as one could have solved it by simply stating: return str*n
Thanks again for your videos!

christofweber
Автор

Can someone tell me why do we put a zero number when getting a total value for smth (7:19) .. maybe the question is absurd but I am a beginner. Thank you in advance!

mirsadkuljici
Автор

You can also do this:

def string_times(str, n):
return (str * n)

Автор

Index of 25 positions with weights varying from about 180 to about 250, and you have what looks like an MIT flag on your wall. I would guess the Bruins.

matthewwalsh
Автор

For the 24:31 Exercise, I want to ask that why my code doesn't work? What's the difference?

def string_times(str, n):
for i in range(n):
return str*n

eikun
Автор

For an absolute, absolute beginner, how do we arrange numbers in ascending or descending order/ Thank you

BN-hynd
Автор

What is "i". Can it be something else instead of "i" when you type "for 'i' in range (10):" ?

babitakarki
Автор

def string_times(str, n):
non = int(n)
return str*non

mikelim
Автор

hey just never say standard deeev. Other than that it was a great review thanks big fudge

reedshay