ajkim141/mit-course — pull request #1 by buckie (2014-06-28 19:55:50+00:00)
Title: Update problem-set-0.py

`if __name__ == '__main__':` is an important feature for executable code, though the reason is not immediately obvious. When you call `import` for anything, that code executes. So, say you wanted to import this file into another problem set (I know you don't but just imagine), if you don't have the `if __name__ ...` in place the act of importing would cause the code to execute.

What `if __name__ ...` does is that is checks if, during execution, this file is the main entry point (the first file called) and then executes whatever is beneath it. This way you can write both scripts that are both importable & command line executable.

For this problem, you didn't do anything wrong, but it's a useful lesson