Unlike the C family of languages, where program execution starts with the main() function... Python allows code that isn't in a function or class at all. If you import a module containing such code, it will be executed. If this isn't desirable, for example because it's intended to only get used when the module is run directly, putting the code behind a if __name__ == '__main__': guard does exactly that!
if __name__ == '__main__':
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.