Skip to content

CyberDoug/Python-Class-Test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Python-Name-is-Main-Example

This reposity is designed to teach students how the following Python expression works:

if __name__ == "__main__":
    main()

Two files are present: 1) myProgram, which is the primary program and 2) dougsLibrary, which is the library that I created. We import dougsLibrary into myProgram in order to use the functions within it. When we do this, dougsLibrary isn't executed in its entirety. Only the functions we call on from dougsLibrary are executed. Why? Because when we call on dougsLibrary, the if statement "if name == 'main':" inside of dougsLibrary is checking to see if the code has been imported OR if it is being executed directly.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages