Showing posts with label python2.7. Show all posts
Showing posts with label python2.7. Show all posts

Wednesday, January 11, 2017

About Python

Python is a multi function programming language

- this means it can be used to virtually every program. So, in this blog we will try to know Python and how to apply the language to modern day life. But first of all we need to understand the language.
There are many tutorials available in the web. You must visit those tutorials and here is my version of the tutorial. You can learn from here too, if you bear with me.

You can also learn python from sites like -

Install Python:
Install Python by going to the site - www.python.org and download the python 2.7  or 3. Here I am concentrating on Python 2.7. So it is advisable to download the later one.
For windows you have to install Python actually, Python is already installed in Linux or Mac. Just extract the downloaded file and double click setup. exe.
How to check python is  installed properly:
For Linux just open the terminal and type Python. Of out shows a reply message with version on it and a '>>' sign, then you are OK.
For windows, open command prompt and type Python.. That's it. If there is an error like command not found, then set the part variable properly or see if you are in proper directory.

After installation of the python from the instruction above you are ready to rock in the python world. You need to download some modules for required project when needed. You can get all the module in github so no worries in this respect.
Why python is Multi-function Programming Language?
Python can be used in many aspects of our every programming needs- from core programming options where we program different hardware to sophisticated web development , we can use python. Python is in its core is made to do tasks without thinking much about syntax of the programming, and concentrate on the semantics of the program. We will start from our very next blog - let's start by saying 'Hello World'.

Thursday, June 25, 2015

Python Datatypes

As I have told you in the previous post that Python is intelligent enough to know the type of variable by assignment. i.e.
A=5 , is an assignment where Python interpreter automatically sets the type of variable A as integer.
If we take another variable b=2, it will also be integer type.
Not of we try to divide A by b , what will be the result do you think?
>>c=A/b?
>> 2
Why? As integer divided by integer is always integer. Of we convert any of the variables to float we will get float as result. i.e.
>>b=2.0#Automatically set b as float by seeing the float point declaration.
Now,
>>c=A/b
2.5
Other than integer we have string variables, we assign them with a single or double quotes.
>>my_name="I am Anthony"
Or
>>my_name='I am Anthony'
But we can not write like this-
>>my_name="I am Anthony' or 'I am Anthony"
Remember to use same quote at start and at the end.
To write something like  "what's your name ” we have to write exactly like this
>>" what's your name"
Using double quotes for declaring string and single quote for the inner one.
String is huge subject , we will discuss more about it as we go on.
The next entry will be about lists, they day those are 'arrays on steroid'

Feautured Post

Python Trivia Post: enumerate()

Python has a very useful inbuilt function, which is called enumerate(). This is needed whenever you need the numbering of a certain element...