introduce
Getting started with programming using python programming is easy. Basically in every distribution of the linux distro, python is included in the package by default. We can write scripts using python IDE like IDLE or write it using text editor. Incidentally when writing this article I use Ubuntu Mate on raspberry device pi 2.
As usual to start the first application created using python, we will create 'hello world'. I use a text editor, the script looks like this:
Then save the file with the name hello.py. In order to run the file we need to change it so it can be executed. This is done through the terminal, I will not explain the commands on the linux terminal. The commands are as below:
And to execute the file type this command:
Use of Variables In Python
Writing a variable in python on its principle is the same as writing a variable in another programming language. There are rules to follow, like this:
Here's an example script to create a variable:
Below is an example script using the operator:
Posted on Utopian.io - Rewarding Open Source Contributors