Python: While Loops (Reading User Input Indefinitely?!!)

  Рет қаралды 12,583

Afternerd

Afternerd

Күн бұрын

In this video in the Python tutorial for beginners, I am going to teach you all you need to know about While Loops in Python by going through an example where a user has to interactively enter multiple numbers indefinitely, and we only stop when the input is a negative number.
I will discuss why we need while loops in programming, and the difference between For loops and While loops.
⏰ Timestamps:
00:00 | Introduction
00:15 | Brief summary of For loops
01:05 | When should you use a While loop
02:30 | While loop syntax in Python
06:23 | A simple While loop example
09:56 | An advanced While loop example
13:39 | Summary
Resources:
📝 Python Cheatsheet: www.afternerd.com/blog/get-py...
🖥️ Computer Science guide: www.afternerd.com/blog/learn-...
🐍 Python roadmap guide: www.afternerd.com/blog/learn-...
Courses:
📚 Python OOP: www.afternerd.com/udemy/pytho...
Where you can find me:
ℹ️ Website: www.afternerd.com/​
📸 Instagram: / the_kreamix​
🐦 Twitter: / afternerdtweets
#python #pythonforbeginners #pythontutorial #afternerd

Пікірлер: 11
@smokebeans3715
@smokebeans3715 Жыл бұрын
Great i understood nothing before, now i understand very little.. very helpful
@TheUssmkl
@TheUssmkl 4 ай бұрын
This guy is a great teacher! I'm taking Programming Logic through college and it is confusing. After watching this Afternerd I get it!
@calebmoughkera-65
@calebmoughkera-65 9 ай бұрын
wow! thanks so much. the logic behind the while loop has been my problem until today.
@Gwenc22
@Gwenc22 2 жыл бұрын
Very helpful explanation!
@maharanirani54
@maharanirani54 10 ай бұрын
Great explanation. Thank you!
@amitvashishtha4158
@amitvashishtha4158 2 жыл бұрын
Wow! Very nice.
@tapansaha6624
@tapansaha6624 2 жыл бұрын
Excellent..
@jessicabrauman
@jessicabrauman Жыл бұрын
This is a great explanation, but I think adding the sum function makes it more confusing than it needs to be. It took me a while to understand this video to be honest. Maybe a better example would be something like: i = True while i == True: answer = input("Do you want to continue?" if answer == "Yes" : i = False print("End of loop") Please excuse any mistakes or weird formatting, I am very new to programming.
@davidschrodinger2043
@davidschrodinger2043 2 жыл бұрын
thank youu!
@alone0802
@alone0802 Жыл бұрын
I have doubts in second code in while loop
@harunora13
@harunora13 Жыл бұрын
sum=0 num = 0 while num >=0: num=int(input("Enter a positive integer: ")) if num >=0: sum +=num print(f"sum is {sum}") Sorry because i just started this, but doesnt this look more optimized than your code? Sorry for asking.
Python: Why Do We Need Loops? (For Loops Explained)
22:32
Afternerd
Рет қаралды 3,6 М.
Difference between For loops and While loops (In Python)
10:48
تجربة أغرب توصيلة شحن ضد القطع تماما
00:56
صدام العزي
Рет қаралды 36 МЛН
3M❤️ #thankyou #shorts
00:16
ウエスP -Mr Uekusa- Wes-P
Рет қаралды 14 МЛН
How to Learn Python? (From Zero to Hero)
22:15
Afternerd
Рет қаралды 135 М.
Python Tutorial 13: Understanding Python While Loops
21:56
Paul McWhorter
Рет қаралды 20 М.
Self Taught Programmers... Listen Up.
10:00
Kenny Gunderman
Рет қаралды 1,8 МЛН
25 nooby Python habits you need to ditch
9:12
mCoding
Рет қаралды 1,7 МЛН
while true loop until quit
6:43
TheEduGeek
Рет қаралды 21 М.
تجربة أغرب توصيلة شحن ضد القطع تماما
00:56
صدام العزي
Рет қаралды 36 МЛН