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

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

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 3 ай бұрын
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 8 ай бұрын
wow! thanks so much. the logic behind the while loop has been my problem until today.
@Gwenc22
@Gwenc22 2 жыл бұрын
Very helpful explanation!
@maharanirani54
@maharanirani54 9 ай бұрын
Great explanation. Thank you!
@amitvashishtha4158
@amitvashishtha4158 2 жыл бұрын
Wow! Very nice.
@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.
@tapansaha6624
@tapansaha6624 2 жыл бұрын
Excellent..
@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,5 М.
The day of the sea 🌊 🤣❤️ #demariki
00:22
Demariki
Рет қаралды 72 МЛН
Children deceived dad #comedy
00:19
yuzvikii_family
Рет қаралды 4,3 МЛН
ИРИНА КАЙРАТОВНА - АЙДАХАР (БЕКА) [MV]
02:51
ГОСТ ENTERTAINMENT
Рет қаралды 3,4 МЛН
Climbing to 18M Subscribers 🎉
00:32
Matt Larose
Рет қаралды 35 МЛН
Difference between For loops and While loops (In Python)
10:48
User Input and While Loops - Python Crash Course - Episode 7
54:15
Learning Python
Рет қаралды 10 М.
Self Taught Programmers... Listen Up.
10:00
Kenny Gunderman
Рет қаралды 1,8 МЛН
Python Tutorial 13: Understanding Python While Loops
21:56
Paul McWhorter
Рет қаралды 19 М.
How Long Does It Take to Learn Python? (And Get a Job)
9:13
Afternerd
Рет қаралды 911 М.
#20 Python Tutorial for Beginners | While Loop in Python
12:43
Telusko
Рет қаралды 1,6 МЛН
5 Tips To Write Better Python Functions
15:59
Indently
Рет қаралды 93 М.
The day of the sea 🌊 🤣❤️ #demariki
00:22
Demariki
Рет қаралды 72 МЛН