General Operations in python

Alright I hope you have python installed on systems by now. If not you can refer to the previous post to know how to and from where to install Python programming language.

For now you can use the online available compiler.

Now if you are already familiar with Coding in C++  you would all know a statement is terminated using ” ; ” but here in python we dont use semi colon but rather whitespaces determine the the flow of code so for example body of a while loop in C++ and other similar language is governed by the { } curly braces example below:

while (condition)




In python this is done by indenting or giving white space.

for example while loop in python :

while condition :

<whitespace> <body>

< body continued>

To read more about the white space follow this link to stack overflow

Today we deal with Basic requirements like print , defining variables and working with variables 

  • Variable in python

Defining and initialising variables is very easy in python as there is no requirement for specifying the data type the variable is going to hold.

so a simple definition of a variable named integer can be done as follows

>>> Integer=10

A string can be defined by using quotes as follows

>>> String= ” My name is jot “


>>>String= ‘ My name is jot ‘


  • Print procedure 

print function or procedure can be used to output a result or display a value of a variable . No need to enclose the  variable  in brackets

>>> print ” my name is jot ”              # prints the string

>>> print Integer                                  # print the value stored in the integer variable


For now these are the basics. We will be  now be discussing arithmetic operations on variables .

Ohk so we start off with the very basic Python arithmetic operations .

General purpose interger addition substraction are demonstrated below

>>> 1+2




These are very basic operations and I assume there is not much need in elucidating or  to expound upon these. I will therefore skip to very important aspects of any programming language to Data Structures in the next post



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s