Python While Loops & For Loops | Python tutorial for Beginners

  Рет қаралды 14,333

Dave Gray

Dave Gray

Күн бұрын

Пікірлер
@waltribeiro
@waltribeiro Ай бұрын
11:45 you don't need to escape a single apostrophe if the string uses double apostrophes. Likewise, you don't need to escape a double apostrophe if the string uses single apostrophes. For example, print("Glad that's all over!") and print('Glad that"s all over!') will both work. It's only an issue if the string and the escape use the same single- or double-apostrophes. Awesome video BTW!
@cookie12932
@cookie12932 27 күн бұрын
Thanks
@MassiveMania
@MassiveMania 5 ай бұрын
11:45 no need to escape the apostrophe since it is enclosed in double quotes.
@siavoshoon
@siavoshoon Жыл бұрын
Just wanted to say thanks for the awesome content on your KZbin channel! I'm learning a lot from you and it's really cool to see kind-hearted people like you out there. Keep up the great work!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Awesome, thank you!
@VictorChukwuemeka-o3x
@VictorChukwuemeka-o3x 8 ай бұрын
I like how I am able to solve little problems on my own thanks to your sensible teaching Dave a little progress everyday goes a long way, progress over perfection
@Omer698
@Omer698 10 ай бұрын
Thank you for the video. One of the hardest thing about coding for me is the order in which you type things out like you mention in the continue section (3:40) I wish more teachers would focus on that
@7doors847
@7doors847 Жыл бұрын
Amazing Dave! You are relentless 💪 Congrats on the 150k subs, very deserving of such and more.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Thank you very much!! 🚀🙏
@Nightmare95935
@Nightmare95935 16 күн бұрын
FWI, for the print("Value is now equal to " + str(value)) statement could be rewritten as print(f"Value is now equal to: {value}")
@codehound8033
@codehound8033 Ай бұрын
You are an excellent teacher. Thank you.
@johnaweiss
@johnaweiss 11 ай бұрын
4:35 So, the `else` is executed when the while finishes. `break` will skip past anything in the `else`, correct? Therefore, if there's no break statement in the while loop, then anything in the `else` could be place completely AFTER the entire `while` block -- it will get executed just the same. CORRECT?
@johnaweiss
@johnaweiss 11 ай бұрын
5:18 i believe int's can be printed. I think the problem here is that you tried to CONCAT an int to a string, not that you tried to print an int.
@1conscience0dimension
@1conscience0dimension Жыл бұрын
11:56 you don't need to escape the ' print("glad that's over") or print(' another "example" ')
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Sure, but it's not a bad habit to learn as sometimes it is needed and doesn't hurt anything in this case. Reference for escape characters for anyone reading: www.w3schools.com/python/gloss_python_escape_characters.asp
@utinthein7274
@utinthein7274 Жыл бұрын
Thank you, Sir.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Welcome!
@adony1800
@adony1800 Жыл бұрын
​@@DaveGrayTeachesCode At 3:50. Next time you need to move a line of code you can do it with -> (ALT + UP or DOWN) arrow keys. Also works if you select a block of code.
@utinthein7274
@utinthein7274 Жыл бұрын
@@DaveGrayTeachesCode 🥰
@muzhaffarhaydar7928
@muzhaffarhaydar7928 5 ай бұрын
thanks dave
@alexanderkomanov4151
@alexanderkomanov4151 Жыл бұрын
Thanks Dave!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Welcome!
@rokib97
@rokib97 Жыл бұрын
"When you use the variable name 'playagain' for both the loop condition and the 'play again' input, declaring the variable with the same name 'playagain,' it is working due to a truthy value. However, is this considered good practice?"
@miedsekadse7136
@miedsekadse7136 Жыл бұрын
👍
@PeranMe
@PeranMe Жыл бұрын
It’s a little unfortunate to reuse the ”playagain” variable as the input destination. It certainly illustrates that the ”continue” statement doesn’t evaluate the ”while” condition, but it might trip up a beginner in a different situation. Regardless, thoroughly enjoying this series, thanks for sharing!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
It appears I have created some confusion because the "continue" statement goes to the next iteration, but before it starts the iteration, the "while" condition is evaluated. As long as "playagain" has a value that is not False, it is considered to be True. Test this out by assigning a string to a variable. Then make an if statement that says if (variablename): print("This is true") ..it will evaluate as true.
@PeranMe
@PeranMe Жыл бұрын
@@DaveGrayTeachesCode Aaahhh…. You’re absolutely right, my bad! See, this is why I watch beginner videos too, despite having used Python for more than 11 years now - there’s always something you’ve missed along the way. Again, thanks!
@willyhorizont8672
@willyhorizont8672 Жыл бұрын
dave_upload_video = True while dave_upload_video: if is_video_ends(): break like() comment() if not is_subscribed(): subscribe()
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Nice!!! 💯🚀
Python Functions for Beginners | Python tutorial
15:15
Dave Gray
Рет қаралды 11 М.
Python Lists & Tuples for Beginners | Python tutorial
32:01
Dave Gray
Рет қаралды 18 М.
Каха и дочка
00:28
К-Media
Рет қаралды 3,4 МЛН
Cheerleader Transformation That Left Everyone Speechless! #shorts
00:27
Fabiosa Best Lifehacks
Рет қаралды 16 МЛН
For loops in Python are easy 🔁
5:06
Bro Code
Рет қаралды 413 М.
'While' loops in Python
10:49
JackWritesCode
Рет қаралды 7
Python Data Types for Beginners | Python tutorial
37:28
Dave Gray
Рет қаралды 40 М.
Please Master These 10 Python Functions…
22:17
Tech With Tim
Рет қаралды 237 М.
5 Good Python Habits
17:35
Indently
Рет қаралды 663 М.
Python Dictionaries and Sets for Beginners | Python tutorial
29:54
What Happens When Renata has 2 Urf- Angel Staffs?
19:08
Python 101: Learn the 5 Must-Know Concepts
20:00
Tech With Tim
Рет қаралды 1,2 МЛН
Python File Handling for Beginners
22:40
Dave Gray
Рет қаралды 23 М.