Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
Dig into how dunder main works when importing code into another file.
Best Practices
Most of the code should be inside functions or classes
Use dunder main to control your code execution
Use a function called main()
to contain code you want to run and call other functions from main()
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Karyna Reut
1,611 Points1 Answer
-
Ali Colak
2,192 PointsI still don't understand how the Dunder Main works, I understand the __name__ equals the __main__, but why?
Posted by Ali ColakAli Colak
2,192 Points1 Answer
-
Erik Embervine
Python Development Techdegree Student 2,442 Points2 Answers
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up