This tut is for Python beginners only. lets start a very basic Python example of codes. despite its very basic, you'll always use them in your next Python journey.

in previous posts, I wrote how to install in your OS :

Pick one of them if you have not installed it yet (depends on your current OS)

Variables

In Python, you can declare variable very easily and name them your way. This example is not in OOP for we're not going there yet.

#!python  example.py

# remember that python doesn't have ; code separator
a = None
b = []  #define as a list
c = 0  #define as integer
d = {} #define as dict
e = () #define as a tuple

print c    #printing your var

run your code in terminal , type: 
python example.py

Operations on variables

1.Arithmetic


      example:

#define your vars

set_var = 20
set_var_2 = 10

print " + operation"
result = set_var + set_var_2  # try to change : * / - or mod 

print "The result is : ",result

       
OperatorDescriptionExample
+Addition - Adds values on either side of the operatora + b will give 30
-Subtraction - Subtracts right hand operand from left hand operanda - b will give -10
*Multiplication - Multiplies values on either side of the operatora * b will give 200
/Division - Divides left hand operand by right hand operandb / a will give 2
%Modulus - Divides left hand operand by right hand operand and returns remainderb % a will give 0
**Exponent - Performs exponential (power) calculation on operatorsa**b will give 10 to the power 20
//Floor Division - The division of operands where the result is the quotient in which the digits after the decimal point are removed.9//2 is equal to 4 and 9.0//2.0 is equal to 4.
#!/usr/bin/python
a = 21
b = 10
c = 0
c = a + b
print "Line 1 - Value of c is ", c
c = a - b print "Line 2 - Value of c is ", c
c = a * b print "Line 3 - Value of c is ", c
c = a / b print "Line 4 - Value of c is ", c
c = a % b print "Line 5 - Value of c is ", c
a = 2
b = 3
c = a**b print "Line 6 - Value of c is ", c
a = 10
b = 5
c = a//b
print "Line 7 - Value of c is ", c
The out put of above codes

Line 1 - Value of c is 31
Line 2 - Value of c is 11
Line 3 - Value of c is 210
Line 4 - Value of c is 2
Line 5 - Value of c is 1
Line 6 - Value of c is 8
Line 7 - Value of c is 2

example from tutorialspoint 



That's it !!!!