Beginning with python
Getting your system ready to start developing with python.
Why start with python?
Python is a fantastic language to start learning coding with. It's has a nice learning curve and is incredibly versatile, and is easy to read and write. Below is an example of a python programme that outputs the statement Hello World!.
print("Hello World!")Introduction
Python is used for many reasons. It is used for:
server-side web development
software development
mathematics, and
system scripting
People use python because it works on different platforms, such as Linux, Mac, Windows, Raspberry Pi, etc, and has a simple syntax that's similar to plain English. Python has a syntax that allows developers to write programs with fewer lines than some other programming languages. Python runs on an interpreter system, meaning that code can be executed as soon as it is written. This means that prototyping can be very quick. And it can be treated in a procedural way, an object-oriented way or a functional way, making it suitable for all developing styles.
Python also relies on indentation, using whitespace, to define scope; such as the scope of loops, functions and classes. Other programming languages often use curly braces for this purpose.
Installing Python
You can install the most recent python version on almost all operating systems by visiting https://www.python.org/downloads/ and downloading the most recent binary.
You can now check your installation by running python3 --version.
And now you can run the following to run your hello world program.
Now you can move onto the next page
Setting up the py alias
py aliasWriting python3 every time you want to run a snip of python code, or a python file, can be tedious. The whole point of python is to be as efficient and streamlined as possible. So, obviously it would be much more convenient to just type the simple py rather than python3. Especially for repeated tasks.
And like everything to do with python.... setting up the alias is easy to do.
Edit the ~/.bashrc file (nano ~/.bashrc) and add the following line to the bottom of it.
Edit the ~/.bashrc file (nano ~/.bashrc) and add the following line to the bottom of it.
Select this option when installing python...
If you haven't selected it already, just rerun the installer, and select the Modify option.
Last updated
Was this helpful?