Significant whitespace
A major difference between Python and most other languages is that additional whitespace can mean something. The indent level of your code defines the block of code to which it belongs. So far, we have not indented the code we have created past the start of the line. This means that all of the code is at the same indent level and belongs to the same code block. Rather than using brace brackets or do and done keywords to define the code block, we use indents. If we indent with four spaces, then we must stick to those four spaces. When we return to the previous indent level, we return to the previous code block.
This seems complex but it is really quite simple and keeps your code clean and uncluttered. If we edit the arg.py
file to prevent unwelcomed errors, if an argument is not supplied, we can see this in action:
#!/usr/bin/python3 import sys count = len(sys.argv) if ( count > 1 ): print("Arguments supplied: " + str(count)) print("Hello "...