1. download python fro https://www.python.org/
2. click on the package to install
3. check. python in terminater
>python --version
Python 2.7.16
4. when using python3, you can input python3
>python3
|
5. create file hello.py with content
print("Hello, World!") |
6. execute the file hello.py
>python3 hello.py |
7. Python uses indentation to indicate a block of code.
The number of spaces is up to you as a programmer, but it has to be at least one.
if 5 > 2: print("Five is greater than two!") if 5 > 2: print("Five is greater than two!") |
You have to use the same number of spaces in the same block of code, otherwise Python will give you an error:
if 5 > 2: print("Five is greater than two!") print("Five is greater than two!") |