#47 Python Tutorial for Beginners | Special Variable __name__ part 2
333.8K views on YouTube
In this lecture we will learn:
– main () function in Python
– How special variable is executed with main()?
– How to restrict the execution of statements present inside the main() function?
– Starting point of execution of code
#1
– When we define a function, then we will have to call that function also to print or perform something.
– main() is the starting point of execution.
– main() function will also work only when we call the main() function.
– From the main() function, we can call all other functions that are available in the code.
– When you import the library or a module, it will execute all statements present inside it.
– And if it contains the callable main() function, then main() will call all functions present in the imported module.
– We can also call the main() function only when we want to execute the particular file as a Standalone program.
– We can control the execution flow of main() by using:
if __ name__ == __main()__
– So by using this, some set of statements will be executed only when we call the __name__.
Github :- https://github.com/navinreddy20/Python-
Editing Monitors :
https://amzn.to/2RfKWgL
https://amzn.to/2Q665JW
https://amzn.to/2OUP21a.
Check out our courses:
Agentic AI Engineering with Python : https://go.telusko.com/agentic-ai-python
Coupon: TELUSKO10 (10% Discount)
Master Java Spring Development : https://go.telusko.com/learn-master
Coupon: TELUSKO10 (10% Discount)
For More Queries WhatsApp or Call on : +919008963671
website : https://telusko.com/
Udemy Courses:
Java Spring:- https://go.telusko.com/Udemyjavaspring
Java:- https://go.telusko.com/udemyteluskojava
Spring: https://go.telusko.com/udemyteluskospring
Java For Programmers:- https://go.telusko.com/javaProgrammers
Python : https://go.telusko.com/udemyteluskopython
Git : https://go.telusko.com/udemyteluskogit
Docker : https://go.telusko.com/udemyteluskodocker
Instagram : https://www.instagram.com/navinreddyofficial/
Linkedin : https://in.linkedin.com/in/navinreddy20
WhatsApp : https://go.telusko.com/whatsapp
Discord : https://discord.gg/D8hWe9BqfF
Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20