if __name__ == "__main__" runs the script which runs from a command line like python myscript.py.
It's typically a module name that exist in all namespace, I'll suggest you to add main() at the final lines, i.e at the end of mycode.py script it will cause the script to uniquely defined main function to run.
There's another benefit to use it as we can also import our code to another script and then it can run the main function if and when the code decides. Ex.
# ... any amount of other code
Hope this helps, Cheers..!!