You only need the __main__ magic if you want a python file to be both a module and an executable script. This is a moderately advanced requirement. Beginners will tend to write scripts OR importable modules.
It's a good technique prior to introducing formal unit testing (and even then, supplemental ad hoc has advantages).