if __name__ == '__main__' for Python beginners 📥

  Рет қаралды 13,922

Bro Code

Bro Code

Күн бұрын

Пікірлер: 25
@BroCodez
@BroCodez 6 ай бұрын
*You can also run a script by right clicking within that script and selecting 'Run'. I forgot about that shortcut while filming this video.* if ___name___ == __main__: (this script can be imported OR run standalone) Functions and classes in this module can be reused without the main block of code executing Good practice (code is modular, helps readability, leaves no global variables, avoids unintended execution) Ex. library = Import library for functionality. When running library directly, display a help page # ---------- script1.py ---------- # This file can run standalone or be imported def favorite_food(food): print(f"Your favorite food is {food}") def main(): print("This is script1") favorite_food("pizza") print("Goodbye!") if ___name___ == '__main__': main() # ---------- script2.py ---------- # This file should run only standalone from script1 import * def favorite_drink(drink): print(f"Your favorite drink is {drink}") print("This is script2") favorite_food("sushi") favorite_drink("coffee") print('Goodbye!')
@kamranalizade98
@kamranalizade98 6 ай бұрын
Hello my best developer and youtuber wassup man,will Laravel videos come?
@olivergrim7634
@olivergrim7634 6 ай бұрын
all me python skill came from this guy! extremely well made videos!
@user-n6e8r
@user-n6e8r 6 ай бұрын
If bro code only has 1 follower...that's me If bro code has millions of followers... I'm one of them If bro code has no followers... I'm dead.
@SxitxmaNxB
@SxitxmaNxB 6 ай бұрын
As long as you follow him, it doesn’t matter if you’re dead, since it saves 👍
@BaldiReycaster
@BaldiReycaster 6 ай бұрын
Nah... I'd be dead before subscribing
@_EnderTv
@_EnderTv 6 ай бұрын
if ___name___ == "__main__": print("ok") else: delete system32
@SxitxmaNxB
@SxitxmaNxB 6 ай бұрын
That’s wrong, it has to be 2 underscores (__name__)
@_EnderTv
@_EnderTv 6 ай бұрын
@@SxitxmaNxB yt italized the _ for absolutely no reason
@segevlavi3770
@segevlavi3770 8 күн бұрын
DONT DO IT! as you can see in the code he wrote delete system and it will just delete ur system
@Little-bird-told-me
@Little-bird-told-me 6 ай бұрын
THis is the first time I actually understood why what this function used
@domination3428
@domination3428 12 күн бұрын
same here
@muhammadislam7836
@muhammadislam7836 6 ай бұрын
Bro i start your c++ 6 hours course, i follow all instructions but why my ming64 bin folder empty but your was not empty, also g++ --version command got error, i noticed ucrt64 bin folder have those files that were in your ming64 bin folder, so i give ucrt64 bin folder path that worked when i type g++ --version command,.also got first program output in vsc, when i give path ming64 bin when that time i got error in vsc when i output, i wanna ask is this ok giving ucrt64 bin folder path? becuase Ai gemini says maybe this worked but thats not good,pls reply😔
@c-ronos
@c-ronos 6 ай бұрын
1:35 how do i do that in vscode?
@vibingowsic2338
@vibingowsic2338 6 ай бұрын
Hey bro! Could you do springboot tutorials. Please
@technicalswag3925
@technicalswag3925 6 ай бұрын
Sir please continue and complete the react course
@TamilCoder.
@TamilCoder. 6 ай бұрын
Thank you bro❤
@BaldiReycaster
@BaldiReycaster 6 ай бұрын
:)
@Kartik-malviya
@Kartik-malviya 6 ай бұрын
Can you please make a tutorial on Golang, i really wanna learn it from you!
@sammyay-man2754
@sammyay-man2754 4 ай бұрын
What happened if I moved the imported file to other folder ?
@SmortMen
@SmortMen 4 ай бұрын
すし Gud
@mintz347
@mintz347 6 ай бұрын
can you please do spring boot series all aboput java fullstack?
@atomicheartlover
@atomicheartlover 6 ай бұрын
Up! Nice topic bro
@accountdeleted
@accountdeleted 6 ай бұрын
+1
@technicalswag3925
@technicalswag3925 6 ай бұрын
Sir please continue and complete the react course
Learn Python Object Oriented Programming! 🚗
12:18
Bro Code
Рет қаралды 30 М.
10 Important Python Concepts In 20 Minutes
18:49
Indently
Рет қаралды 326 М.
When Cucumbers Meet PVC Pipe The Results Are Wild! 🤭
00:44
Crafty Buddy
Рет қаралды 62 МЛН
Long Nails 💅🏻 #shorts
00:50
Mr DegrEE
Рет қаралды 19 МЛН
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 16 МЛН
Credit card validator in Python 💳
8:54
Bro Code
Рет қаралды 69 М.
While loops in Python are easy ♾️
6:58
Bro Code
Рет қаралды 422 М.
Let's code a beginner Python BANKING PROGRAM 💰
15:01
Bro Code
Рет қаралды 274 М.
SUPER() in Python explained! 🔴
13:06
Bro Code
Рет қаралды 14 М.
If __name__ == "__main__" for Python Developers
8:47
Python Simplified
Рет қаралды 415 М.
If __name__ == '__main__' for Python Beginners
9:29
Indently
Рет қаралды 21 М.
WRITE FILES using Python!  (.txt, .json, .csv) ✍
13:47
Bro Code
Рет қаралды 8 М.
Learn Python OOP in under 20 Minutes
18:32
Indently
Рет қаралды 119 М.
Python *ARGS & **KWARGS are awesome! 📦
14:54
Bro Code
Рет қаралды 85 М.
When Cucumbers Meet PVC Pipe The Results Are Wild! 🤭
00:44
Crafty Buddy
Рет қаралды 62 МЛН