Python Tutorial for Beginners 7: Loops and Iterations - For/While Loops

Python Tutorial for Beginners 7: Loops and Iterations - For/While Loops

Corey Schafer

7 лет назад

857,069 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

TiredSentinel
TiredSentinel - 14.10.2023 23:13

One request. Next time, teach the ‘CtrlC’ stop BEFORE you teach an infinite loop function 😂.

Ответить
Eva Makri
Eva Makri - 20.09.2023 22:27

Honestly speaking (because I've struggled a lot) , there is no loop video that tops yours! You say just what needs to be said to grasp the general idea! Thanks man, you are the best! I will absolutely watch your content!

Ответить
Patrick Wheeler
Patrick Wheeler - 14.09.2023 21:18

Good stuff, just got done with Pandas a few weeks back and now I am filling in some gaps. Thanks for this wonderful content

Ответить
Uti_s14
Uti_s14 - 05.09.2023 21:09

Ctrl + C do not work for me, stopping the infinite loop on a PC. Why? Thanks for the great tutorials. And how did you mark out and comment out multiple lines at once? Cheers

Ответить
Kylie Thd
Kylie Thd - 31.07.2023 15:50

even if you don't you don't put the continue statement after the print('Found!') it will continue though

Ответить
Dennis Mwangi
Dennis Mwangi - 12.07.2023 15:25

nice one

Ответить
rip_F4KE
rip_F4KE - 17.06.2023 21:51

weeze was here

-to my future 23 subscribers :3

Ответить
Sedef Sarialan
Sedef Sarialan - 06.06.2023 15:13

i love you thank you so much thank you this has literally saved my life

Ответить
Kris
Kris - 28.05.2023 06:27

i love you

Ответить
Divine Dream
Divine Dream - 14.05.2023 07:14

thanks

Ответить
She_cooks2023
She_cooks2023 - 08.05.2023 13:23

Loving the series!

Ответить
Rajiv Jani
Rajiv Jani - 24.04.2023 22:18

Super! Thank you for sharing!

Ответить
Anatoliy Loboda
Anatoliy Loboda - 18.04.2023 22:59

Corey! Thanks for video!
If it is possible I`d like to ask you to tell about how we can break an outer loop when some condition is met in an inner loop.

Ответить
Rene Granit
Rene Granit - 17.04.2023 23:58

your videos are so unbelievably good. The things i dont unterstand in a whole schoolyear i learn in a couple days from your videos

Ответить
ramaz kurdadze
ramaz kurdadze - 29.03.2023 22:14

so clear and brilliant explanation

Ответить
Toca_aishh♥️
Toca_aishh♥️ - 29.03.2023 09:09

👍best video with clear and neat explaination

Ответить
Adawyah A.
Adawyah A. - 27.03.2023 11:15

Good lecturer. It is clear :)

Ответить
Rzgar Deep
Rzgar Deep - 25.03.2023 00:46

well done man

Ответить
Terka Juchelková
Terka Juchelková - 23.03.2023 20:54

Ctrl + C does not work for me to stop the infinity while loop. As my laptom does not have any Pause/Break keys on keyboard I am stuck. The only way is through Tools -> Cancel Build, but I do not like that way. :/

Ответить
Brandon's Excel Tutorials
Brandon's Excel Tutorials - 09.03.2023 00:32

Love the way that you explained this, I finally feel like this is starting to click. Thank you!

Ответить
Warfalcon
Warfalcon - 03.03.2023 03:32

Your examples you provide are so much more helpful then the very basic "here is a for loop" explanation. You go one extra step to provide a more real world use, which is much more helpful for me. Thank you!

Ответить
Kojo Mensah
Kojo Mensah - 16.02.2023 16:19

Just wonderful

Ответить
Tony's World
Tony's World - 12.02.2023 16:20

this is amazing, thank you.

Ответить
Zain Khan
Zain Khan - 09.02.2023 20:10

Why is it stuck in an infinite loop?

Code eg:

a=10

While a<=10:
If a==18
print(’found’)
continue
Print(a)
a+=1

Is it cause the continue overwrites the while condition?

Ответить
Shiba g
Shiba g - 01.02.2023 04:05

I have been struggling SO hard with loops in my Intro to Programming class and this helps so much. Thank you!

Ответить
harvey tiven
harvey tiven - 24.01.2023 21:17

I'd like to know real-life examples of applications of loops, trying to visualize some of these lessons as I go. Thanks

Ответить
helping_buddy
helping_buddy - 23.01.2023 16:09

What does X += mean here , what is it’s need

Ответить
Rambabu Boddani
Rambabu Boddani - 21.01.2023 17:06

In while why you use x*=1 and what thats mean

Ответить
Tj Smith
Tj Smith - 21.01.2023 07:57

Wow! You are the first person I've came across on the internet who has explained this so well! Thank you Corey!!! I'm a math fanatic and I wanted to learn iterations and loops so badly for my own sake but apparently no one explained well enough how to make the infinite loop stop without pressing ctrl C, as they didn't know how to explain well enough.

Ответить
Farshid Civil
Farshid Civil - 12.01.2023 17:58

hi
is there any difference between continue and break in nested loop (in general) (for below example there is no difference)
for i in range(1,6):
for j in 'abc':
if i==3:
break
print(i,j)

Ответить
steve low
steve low - 17.12.2022 08:03

Hi beginner here. May I know why x=0 can go through the while True loop? I remember in the previous tutorial we learnt that 0 is a False value.

Ответить
Prajan Anandaraj
Prajan Anandaraj - 08.11.2022 16:47

Thank you for explaining. I have subscribed your channel, you just helped me with a complicated loop. thank you so much

Ответить
Kudakwashe Marz
Kudakwashe Marz - 17.10.2022 17:32

WHICH APPLICATION WERE YOU USING TO CODE AND RUN YOUR PROGRAMS?

Ответить
proIdeas
proIdeas - 16.10.2022 02:52

calling main function, my program runs only twice....then it starts printing same value that I give it as input

Ответить
Manjunath B
Manjunath B - 08.10.2022 16:53

Why break statement is not working here?

year=int(input())
if not 1900<=year<=2500:
print('invalid year')
break
if year%4==0 and (year%100!= 0 or year%400==0):
print('Its a leap year')
else:
print("Its not a leap year")

Ответить
Jovana Pesut
Jovana Pesut - 08.10.2022 16:40

Can you explane what a sentinel in python is?

Ответить
Daniel Fry
Daniel Fry - 06.10.2022 14:27

I like your style Corey :) many thanks

Ответить
MattWatsonHarmonica
MattWatsonHarmonica - 23.09.2022 05:26

While loops have always been confusing to me. Thank you for clearing this up!

Ответить
Maximillian Ramirez
Maximillian Ramirez - 26.08.2022 10:46

Your videos are so easy to follow 👍

Ответить
Xalindor
Xalindor - 16.08.2022 23:19

most of this makes sense, Thanks for the content but one questions. how does for num in nums works? technically you have specified what num is. nums = [ list ]. how does it know what num is.

Ответить
OĞUZ TÜRKYILMAZ
OĞUZ TÜRKYILMAZ - 12.07.2022 21:05

Thanks

Ответить
Joey Zalman
Joey Zalman - 08.07.2022 14:51

very clear thank you!

Ответить
Chaim Wuensch
Chaim Wuensch - 27.05.2022 02:55

really helpful, you did a great job explaining the different loops too, thank you!

Ответить
Glamify
Glamify - 24.05.2022 21:59

Another awesome breakdown. Very simple and easy to follow

Ответить
sriteja vavilala
sriteja vavilala - 22.05.2022 17:59

This channel deserves more subs

Ответить
Leyna Hoang
Leyna Hoang - 01.05.2022 05:50

thanks for creating this video. reviewing for my comp sci midterm

Ответить
Adi Mizrahi
Adi Mizrahi - 12.04.2022 17:33

that so F**ing easy now damn ive try do understend that for 2 days and here u come with a damn 11 min video and now i can explain it OMG i was so frusterated!!! ty so much man

Ответить