Python is a general-purpose, dynamic, interpreted and object-oriented programming language. It is one of the most popular and fastest growing programming languages in the world. It is used in wide variety of applications including web development, data analysis, and running background tasks.
Python has a simple, easy to learn syntax, which emphasizes readability. Applications written in Python can run on almost any computer, including those running Windows, macOS, and all popular Linux distributions. The Python ecosystem has grown over the years and contains a wide range of development tools for writing, debugging, and publishing Python applications.
- A computer that can install and run Python.
- A desire to learn how to code!
With that being said, let's get started!
Python is an interpreted language, which reduces the edit-test-debug cycle because there's no compilation step required. In order to run Python apps, you need a runtime interpreter to execute the code.
The python code is compiled into a lower-level, and platform-independent byte code. The byte code compilation happens internally and hidden from developer.
The byte code then gets picked up by the Virtual Machine and executes the byte code instructions step by step to carry out their operations.
If you already have Python installed, you can skip this section. Otherwise, install the latest version of Python 3.
Head over to the downloads page to get your copy.
Please note that, Python comes bundled with Mac OS X. But the version that you have is quite likely an older version. Download and install the the latest binary version of Python that runs on both Power PC and Intel systems.
You can verify the installation by running the following command on your terminal.
Alternatively, you can type:
This command will simply print the Python version installed in your computer.
python -V Python 3.10.6
Writing Your First Python Program
Create a new file titled
helloworld.py. Inside the file, put this code in::
To run the program, type
python3 helloworld.py command and hit Return.
$ python3 helloworld.py Hello World!
Congratulations! You just wrote your first program in Python. As you can see, this was a pretty easy task. This is the beauty of the Python programming language.
Python is licensed under OSI open source license and there are multiple implementations available depending upon your requirements.
- CPython: Commonly used for web development, application development and scripting.
- Anaconada: This distribution is used for scientific programming tasks such as data schience and machine learning.
- Iron Python: Open source implementation built for .NET runtime
- Jupyter Notebook: Jupyter Notebook is a web-based interactive programming environment that supports various programming languages, including Python. Used mainly for academic research and mathematical modeling, machine learning and for teaching.
You now have everything you need to begin this class on Python! Let's get started with Python!