Python For Loops - Python Tutorial for Absolute Beginners

  Рет қаралды 544,508

Programming with Mosh

Programming with Mosh

5 жыл бұрын

Python for loops. Learn Python basics with this Python tutorial for absolute beginners.
🔥Subscribe for more videos like this: goo.gl/6PYaGF
🔥Python tutorial for beginners: • Python Tutorials for B...
Python Exercises for Beginners:
programmingwithmosh.com/pytho...
Python Cheat Sheet:
programmingwithmosh.com/pytho...
Want to learn more from me? Check out my blog and courses:
programmingwithmosh.com
/ programmingwithmosh
/ moshhamedani

Пікірлер: 267
@brianligat2038
@brianligat2038 Жыл бұрын
I cannot recomment Mosh's tutorials enough. Easy to follow, helpful and friendly style.
@henryalohfabian6686
@henryalohfabian6686 7 ай бұрын
What is true and false
@henryalohfabian6686
@henryalohfabian6686 7 ай бұрын
And why those he keep using it
@aliasad1392
@aliasad1392 4 жыл бұрын
I am a new learner. And for some reason i feel it complicated dealing with loops. But i am determined. Hope so will understand it soon. Mosh you are a great teacher. God bless you.
@KidsLearnHTML
@KidsLearnHTML 4 жыл бұрын
Hi, I'm a high school teacher -and I COMPLETELY agree. It's like he's adding things that can distract from the learning process. For example using range instead of a regular list of let's say ["cow", "pig", " duck", "hen"] or ["baseball", "football", "swimming", "judo"]. It's kinda like a teacher using 2 or 3 terms a kid doesn't understand -to explain the FIRST term that the kid doesn't understand.
@mohammedalzamil7191
@mohammedalzamil7191 4 жыл бұрын
its been 8months did u get anywhere with coding?
@aliasad1392
@aliasad1392 4 жыл бұрын
@@mohammedalzamil7191 nah mate. Unfortunately i couldn't concentrate. Had to start my job to had less time for coding. I am sad
@mohammedalzamil7191
@mohammedalzamil7191 4 жыл бұрын
@@aliasad1392 man start again I started about 3 days ago and the thrill of running the program and it actually works is invaluable, look up the 4hr course on python it'll give u a good start
@swallowedinthesea11
@swallowedinthesea11 3 жыл бұрын
Loops are one of the most riotously difficult topics for beginners in all languages, not just Python. I found it confusing when I first began. You just have to keep practicing. 06202020
@syedmohammedakberhussaini5620
@syedmohammedakberhussaini5620 Жыл бұрын
Dude, You made my Basics Very Strong print("Thank You Mosh")
@Ushq_QgA
@Ushq_QgA Жыл бұрын
super gədə
@the_seahawk22
@the_seahawk22 4 жыл бұрын
I feel like reading the actual code or trying to determine what to type is why for loops are so fucking difficult to understand. Most of the time I am staring at other people’s code just overwhelmed
@murder8928
@murder8928 3 жыл бұрын
dude exactly, i have to write shit down
@OmSaiSwarupSetty
@OmSaiSwarupSetty 3 жыл бұрын
Exactly the same feeling of mine too
@alyanna1260
@alyanna1260 3 жыл бұрын
ahh same same:((
@Asterics.
@Asterics. 2 жыл бұрын
same here man, logic is so hard to mix with any other data type
@amandal8404
@amandal8404 3 жыл бұрын
this was exactly what I was looking for. it was a bit hard to follow written tutorials, so thanks for such a clear and concise one here!
@invinciblenoman
@invinciblenoman 2 жыл бұрын
I believe self-learning of programming becomes easier if you start implementing your latest learned codes in small programs. such as Mosh just made in exercise. try to find small exercises for 'for loops, nested loops, with if statements. it will increase your learning pace and keep you motivated.
@brianligat2038
@brianligat2038 Жыл бұрын
I split mine into different modules to experiment with particular topics. Easy to add to without a single module getting too large and messy. My main just has a menu (2 dictionaries of options and functions). I could then add other bits like a TicTacToe and Minesweeper game.
@tcpnetworks
@tcpnetworks 3 жыл бұрын
Sir - you are absolutely awesome to listen to :) Thank you for making this language so much fun.
@faridgulum1226
@faridgulum1226 3 жыл бұрын
Thank you, Mosh. I learned the parts I lacked as a beginner. I also learnt how to add int to string in print function. :)
@NachoManBoy4
@NachoManBoy4 2 жыл бұрын
you should become a hacker for the United States NSA :))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
@narutoxtreme123
@narutoxtreme123 Жыл бұрын
Just want to say thanks 🙏🏽. I have been using your videos along with my course work. Awesome 👏🏽
@smaransure2234
@smaransure2234 2 жыл бұрын
Thank you so much. I am pretty intermediate, but I never knew exactly how loops work. This video helped alot, so thank
@epicvoyager5938
@epicvoyager5938 7 ай бұрын
Thank you for the simple and quick instructions, you've been a great help!!
@harshalnath4853
@harshalnath4853 2 жыл бұрын
first I am gonna take break in the middle of this video while learning and comment for this guy because this man deserve a huge respect because I roamed around so many videos but no one is so good as him love u man.
@vatsal_gamit
@vatsal_gamit 4 жыл бұрын
one the best videos on the internet for loops
@druskii90
@druskii90 Жыл бұрын
Thank you for explaining for loops very clearly, idk I've been struggling to understand them and this helped so much! Sub earned!
@md.mahedihasanhridoy3571
@md.mahedihasanhridoy3571 5 жыл бұрын
Very nice presentation and you make coding just simple.
@praanadhyarlagadda6413
@praanadhyarlagadda6413 Жыл бұрын
thanks so much, i have an exam.
@amilcarromero4656
@amilcarromero4656 6 ай бұрын
Lol, We all do
@Ali-xj8bs
@Ali-xj8bs 5 ай бұрын
Me too 😢
@ayaashraf5960
@ayaashraf5960 5 ай бұрын
same
@besnergreen
@besnergreen Ай бұрын
Haha samee.. gotta attend more classes
@accio5557
@accio5557 3 жыл бұрын
thanks a lot mosh i am glad i found this tutorial
@alexgicheha5755
@alexgicheha5755 Жыл бұрын
Hi Mosh! You're the best Tutor. I am looking forward to learning more from you. I want to learn python for data analysis, web development, and game development. I welcome all the challenges, but I am passionate about becoming a Pythonista. Whatever it takes, Mosh, as long as you're my tutor, I know I'll make a great programmer like you.😘🤩
@patricias9866
@patricias9866 Жыл бұрын
Wow!! This is awesome. I'm in a bootcamp and this was confusing. Thanks for posting this. I hipe you consider posting more recent tutorials.
@HelenNPerlas
@HelenNPerlas 2 жыл бұрын
Thank you Mosh! I survived this topic. It helped a lot in my lessons on looping in Python.
@NachoManBoy4
@NachoManBoy4 2 жыл бұрын
Clap clap clap. Hooray for you, tutor me?
@sabamohammadi4617
@sabamohammadi4617 3 жыл бұрын
دستت درد نکنه ماش بعد از چند تا ویدئویی که از for loops دیدم با ویدئوی شما بالاخره کار کردن باهاش رو یاد گرفتم
@BIackBoomBox
@BIackBoomBox Жыл бұрын
Love the example you showed with the email. Made it easier to understand
@uffeheden6100
@uffeheden6100 2 жыл бұрын
Thanks! Exactly what I'm looking for where I'm in my learning curve. Great with the addons where most courses go. Cheers!
@NachoManBoy4
@NachoManBoy4 2 жыл бұрын
what the fuck do you mean by that?
@NachoManBoy4
@NachoManBoy4 2 жыл бұрын
😅😅😅
@TheTitanGrimm
@TheTitanGrimm Ай бұрын
Well you have the best explanation on for loops. Most other videos I couldn’t apply to my program. Thank you.
@alaskachan5914
@alaskachan5914 3 жыл бұрын
thank you very much for this tutorial.
@jimgraham1404
@jimgraham1404 7 ай бұрын
Thank you mosh. I know it’s simple and it’s perfect 😊
@airmett8939
@airmett8939 11 ай бұрын
for x in range(1, 10): if x%2==0: print(x)
@bishakhadeb1800
@bishakhadeb1800 3 жыл бұрын
Thanks Sir. You're the best :)
@a.b.3030
@a.b.3030 2 жыл бұрын
Very good explained. Thank you.
@pookie47
@pookie47 Ай бұрын
This was so helpful me to me to understand.. and like.. comprehend. thank you
@christianwiah4526
@christianwiah4526 Жыл бұрын
Thanks, Mosh - Your lectures are simplified and easy to follow.
@easydatascience2508
@easydatascience2508 Жыл бұрын
See mine too. Easy to follow, most of the fundmental tutorials for Python and R. Source files can be found in the description of each video, by the way.
@user-ym2ys9ij5r
@user-ym2ys9ij5r 5 ай бұрын
bless you my man, bless you. Top tier crash courses out there
@lesyamaur7787
@lesyamaur7787 3 жыл бұрын
This was really helpful
@kevinflynn4867
@kevinflynn4867 2 жыл бұрын
Thank you Sir ! Your video were very helpful
@mohammadanarul624
@mohammadanarul624 4 жыл бұрын
thank you sir..
@benlong1080
@benlong1080 2 жыл бұрын
Hey, awesome and informative vid! I like the challenges included. But quick question. I ran my code: for even_num in range (1, 9, 2): print(even_num) print("We ......") And it was successful. I wish I would have written the more sophisticated way, but can you tell me how mine would not function the same ultimately? Thanks!
@simphiwemtshali5452
@simphiwemtshali5452 Жыл бұрын
I didn't understand my lecturer thanks to you... you the best
@chunyiptaxi
@chunyiptaxi 11 ай бұрын
thanks for your clear explanation
@codewithelyanan6536
@codewithelyanan6536 3 жыл бұрын
I finally understand about loops in python
@rohitsd7732
@rohitsd7732 8 ай бұрын
for even in range(1,10): if even%2==0: print(even) print('we have 4 even numbers')
@nakshathraopillai679
@nakshathraopillai679 2 жыл бұрын
REALLY HELPFUL !!!!!!!!!!!!
@priyankadhage700
@priyankadhage700 3 ай бұрын
This only video helped a lot . Thanks
@freehappymeal
@freehappymeal 2 жыл бұрын
I like the way you explain this concept. It helped to see what was going on in the nested loop.
@zahrabolghanabadi1478
@zahrabolghanabadi1478 4 ай бұрын
You are the best teacher in coding❤
@user-ce3vr2dp6i
@user-ce3vr2dp6i Жыл бұрын
Hello there Mosh! This is my exercise code (12:37) My code: for i in range(2, 9, 2): print(i) print('We have 4 even numbers')
@t3rm1nat0r4
@t3rm1nat0r4 7 ай бұрын
Yeah this works really well in practice, and I don't see a situation where you can't use it but he specifically said not to add the third variable in the first parenthesis
@BettoRaite_
@BettoRaite_ 2 жыл бұрын
iterables are the things that can launch the for loop and make the sequence of repetitions #I don't know if it's the right definition, but this is how I interpretered the meaning of iterables
@iyazbhat8213
@iyazbhat8213 4 жыл бұрын
In which VSCode Extension you're running code, if it's other then Terminal.
@cornationboot8690
@cornationboot8690 7 ай бұрын
count = 0 for x in range (2,10,2): print(x) count +=1 print("We have {count} even numbers")
@ocraking
@ocraking Ай бұрын
Great tutorial, many thank yous haha ;)
@muhammadbilalmemon6982
@muhammadbilalmemon6982 5 жыл бұрын
Great Explanation :)
@neerajnegi3517
@neerajnegi3517 6 ай бұрын
Really easy to understand
@basicknowledge2472
@basicknowledge2472 5 жыл бұрын
Best Video Sir
@dineshpokala2939
@dineshpokala2939 4 жыл бұрын
Perfect
@Luka_WiFi
@Luka_WiFi 4 жыл бұрын
for num in range(2, 10, 2): print(num)
@phuongdungnguyenthi1574
@phuongdungnguyenthi1574 2 жыл бұрын
Hi Mosh, thank you so much for your video! it's so helpful. I would like to ask that could I write the code like this: for x in range (2,10,2): Print (x)? When I run my code, it's still shown the similar result.
@ErrorXTech
@ErrorXTech 2 жыл бұрын
2, 3, 4, .... 9
@estherdouglas6096
@estherdouglas6096 2 жыл бұрын
2 4 6 8
@muhammadnajamulislam2823
@muhammadnajamulislam2823 5 жыл бұрын
very nice and easy way of teaching... thanks for your effort. :)
@yourpapa6641
@yourpapa6641 7 ай бұрын
count = 0 for x in range (1,10): if x % 2 == 0: count += 1 print(x) print("We have " + str(count) + " even numbers")
@cornationboot8690
@cornationboot8690 7 ай бұрын
hi bro why u use using concatenation, it will just merge them together instead try using , instead of +
@SerapioSergiovich
@SerapioSergiovich 4 сағат бұрын
Nice video shows methods to create a business..
@LittleAres
@LittleAres 2 жыл бұрын
another way to solve the exercise could be this: for i in range(0,10,2): if i > 0: print(i) print('we have 4 even numbers') the result is still the same:D
@ganeshofficialyoutupechann4768
@ganeshofficialyoutupechann4768 3 жыл бұрын
thank you sir
@KamaraKabbahsorie
@KamaraKabbahsorie Ай бұрын
That's what I expected ❤
@karimabrini
@karimabrini 5 жыл бұрын
Thanks Mosh easily explained
@karimabrini
@karimabrini 5 жыл бұрын
@@programmingwithmosh beginner
@sparkscomputerprogramming
@sparkscomputerprogramming 2 жыл бұрын
the best coding teacher in youtube
@jemjemcorner3522
@jemjemcorner3522 4 жыл бұрын
thanks mosh
@paolog2524
@paolog2524 Жыл бұрын
Thank you
@ashleyyy8036
@ashleyyy8036 2 жыл бұрын
sorry to disturb, but I have a stupid question that bogged me down: I see no links between the variable successful and the for loops, so why the statement "successful = True" will affect the correctness, or the execution of the for loops?
@brentdan68
@brentdan68 2 жыл бұрын
If that if statement is false it would not execute it
@dharshinia9378
@dharshinia9378 2 жыл бұрын
an "if" statement will only occur if the given statement is True.
@monttyy4879
@monttyy4879 Жыл бұрын
Your channel is helping me so much .. my teacher is so trash and doesn’t tell us shit and just expects us to understand from reading his examples
@mdbelalhossainsanto6523
@mdbelalhossainsanto6523 4 ай бұрын
#Printing even number for num in range (2,10,2): print (num) print("we have 4 even numbers")
@VotiSam
@VotiSam 6 ай бұрын
even_number = 0 for i in range(1, 10): if i % 2 == 0: print (i) even_number += 1 print(" we have", even_number, "even numbers")
@muhammedmustafa7685
@muhammedmustafa7685 2 жыл бұрын
for i in range(lengte): # Create a list of columns for j in range(breedte): print("*", end="") print()
@emmanuelleallen
@emmanuelleallen 4 ай бұрын
I've been learning Python for about a solid 2 weeks. Self-taught. And so I wouldn't say im an "Absoloute Beginner," but I'm not far off. And this tutorial was actually very difficult to follow in regards to the expectation. IT WAS informative though, and showed me a few things i havent looked at yet, though. I'd reccomend the following changes for videos like this in the future, if youre using the "absolute beginner" title. Any concept that isnt directly related to the for loop, should also be explained in a little bit more detail. You gave a challenge that required using knowledge that wasnt included in this video. These operands "%, ==, =, +=" These commands "if, else" Boolean results "True False" And a few other things. Realistically, this video is one of a series. And the title should be rightly have a series identifier on it. Like "Python for Absoloute begginer 8/20: For Loops" This would give the user the idea that there is likely information refrenced in this video using previous content. And builds off of *some* knowledge base. But meant for very intruductory users. Only sharing these things to help you and the viewers. Best of luck!
@plowe6751
@plowe6751 19 күн бұрын
In the following code, why is the slash sign for division doubled? for i in range(width//2):
@innemannen
@innemannen 5 ай бұрын
Great video
@muhammedmustafa7685
@muhammedmustafa7685 2 жыл бұрын
for number in range(0,101): if(number % 2 == 0): print(number)
@light9808
@light9808 2 жыл бұрын
Thanks
@pcharl01
@pcharl01 5 күн бұрын
I was hopefully watching this would help me with my crash course in python on coursera. I'm not sure if I'm there yet.
@denniskamonde6836
@denniskamonde6836 5 жыл бұрын
Thanks Moshi you're my Hero!
@dawidmarszaek3106
@dawidmarszaek3106 Жыл бұрын
How did you get this nice-looking Output window? I am looking for it for so long and the only one I have got is a terminal window with all of the paths, ending messages which are distracting. I would be grateful for telling me how to open this Output view.
@HimanshuSharma-oy9ss
@HimanshuSharma-oy9ss 4 жыл бұрын
Hello mosh ! I'm taking your free 6 hours python course. But when i tried to solve the 'sum total of prices' problem , even when i typed exactly what you did in the video, my result were iterative instead of a single integer value ( the actual expected sum total ). Is there any settings that i have to change in pycharm ?
@Ohamskillua
@Ohamskillua 2 жыл бұрын
you should check for capital letters make,and also check for indexation,python is case hsensitive
@muhammedmustafa7685
@muhammedmustafa7685 2 жыл бұрын
for i in range(1, 11): print(tafel, 'x', i, '=', tafel*i)
@samirchamling2243
@samirchamling2243 6 ай бұрын
Hi Mosh, I have a list output from my python code that I extract from shareppoint, I stored that list in one variable but when I run for loop, it give me error string is not iterable, how can I loop through string which is in string format ?
@faraic
@faraic 3 жыл бұрын
# great explaination i see why there is a million views.my code as below total = 0 for i in range(1,100): if i%3 == 0 or i%5==0 : total = total + i print(total)
@geminiscrossbow5983
@geminiscrossbow5983 Жыл бұрын
in third lecture what is the purpose of "f" that stands right between the opening pharantez and " ? because when i try to code myself the same, if i open a space after that "f", then it gives error. Couldnt get it?
@jamonlewis6466
@jamonlewis6466 4 ай бұрын
Mosh you have the best tutorials on coding, but I wish, for the love of God someone would explain the syntax of the “for loop” so some sense could be made of why it’s written the way it is. I love how so much of Python correlates with the regular (English) language, but the “for loop” syntax is the most abstract & bizarrely written expression ever & NO ONE who I’ve come across that teaches python seems to think the format of the “for loop” syntax needs to be made since of for people learning python.
@SerapioSergiovich
@SerapioSergiovich 4 сағат бұрын
Nice video shows methods to carry out a way to earn money.
@muhammedmustafa7685
@muhammedmustafa7685 2 жыл бұрын
if (getal % 3 == 0): print('Deelbaar door 3') else: print('Niet deelbaar door 3')
@daviddean5512
@daviddean5512 6 ай бұрын
why for the final example can't you just write for x in range(2, 10, 2): print(x) print("We have 4 odd numbers") Is it because if the interval was something like (2, 198534, 2) you could write the wrong amount
@maryharrer2603
@maryharrer2603 2 жыл бұрын
My Python book is only teaching me math. YOU are teaching me Python. Thank you.
@tixer9786
@tixer9786 Жыл бұрын
I think your way of doing the exercise can be simplified to this: for numbers in range(0, 10, 2,): print(numbers) if numbers == (8): print("There are 4 even numbers") #This is a much easier way of doing it
@solidninja
@solidninja 2 жыл бұрын
this was useful :)
@aliasad1392
@aliasad1392 4 жыл бұрын
If you are not a quick learner as i am Then try slowing video speed. I hope it will work. Slow mosh lolz
@thelolimaster359
@thelolimaster359 Жыл бұрын
So the value of count updates globally because for is not a function?
@faizanrana9049
@faizanrana9049 Жыл бұрын
which tool are you using for python.
@anumthkl9
@anumthkl9 Жыл бұрын
Dear mosh why you are storing the variable successful =True,what if its not there.... thanks'
@joenjuguna93
@joenjuguna93 2 жыл бұрын
GREAT
@muhammedmustafa7685
@muhammedmustafa7685 2 жыл бұрын
i = 0 while(i < 30): print('Hallo') i = i + 1
@abdulmd1083
@abdulmd1083 Жыл бұрын
mosh is genius
@madhavaraj133
@madhavaraj133 3 жыл бұрын
Which ide you using
@YoursTruly78887
@YoursTruly78887 7 ай бұрын
For loops got me stumped but I'm gonna just chug along fuck it
Python Functions | Python Tutorial for Absolute Beginners #1
30:34
Programming with Mosh
Рет қаралды 898 М.
Зу-зу Күлпәш. Стоп. (1-бөлім)
52:33
ASTANATV Movie
Рет қаралды 964 М.
ШЕЛБИЛАР | bayGUYS
24:45
bayGUYS
Рет қаралды 632 М.
Follow @karina-kola please 🙏🥺
00:21
Andrey Grechka
Рет қаралды 17 МЛН
I PEELED OFF THE CARDBOARD WATERMELON!#asmr
00:56
HAYATAKU はやたく
Рет қаралды 33 МЛН
Python for Beginners - Learn Python in 1 Hour
1:00:06
Programming with Mosh
Рет қаралды 16 МЛН
Is Coding Still Worth Learning in 2024?
9:33
Programming with Mosh
Рет қаралды 170 М.
Nested loops in Python are easy ➿
5:35
Bro Code
Рет қаралды 248 М.
Control Flow in Python - If Elif Else Statements
16:08
Programming with Mosh
Рет қаралды 279 М.
Solve any Star Pattern program in Python
18:44
Simply Coding
Рет қаралды 828 М.
How to Use Lists in Python
18:49
Programming with Mosh
Рет қаралды 281 М.
Python 101: Learn the 5 Must-Know Concepts
20:00
Tech With Tim
Рет қаралды 1 МЛН
Зу-зу Күлпәш. Стоп. (1-бөлім)
52:33
ASTANATV Movie
Рет қаралды 964 М.