Jan 17, 2015

Textual description of firstImageUrl

Python fundamentals - Data types and In-built Objects

In previous section we installed python and run hello world program. Now we will delve into building block of python language and will write sample program to understand the same.
As we know that python is both procedural and object oriented language. We will focus on Object oriented aspect of python.
Python is an object-oriented language and classes form the basis for all data types. Python has various built-In Classes like int for integers , float for floating point values and str for character string. i,e: Every thing in Python is class, even primitive data type.
Consider following statement in python :
    student_cgp  =  7.65
How do we interpret this in python - student_cgp is an identifier and it references a floating point object with value 7.65. Two important point need to be noted here is :
1. Identifiers in python are case-sensitive.In Python, identifier is similar to a reference variable in Java or a pointer variable in C++. Each identifier is implicitly associated with the memory address of the object to which it refers.
2. Unlike Java and C++, python is a dynamically typed language, there is no advance declaration associating an identifier with a particular data type. Although an identifier has no declared type, the object to which it refers has a definite type.
Below is the list of built in class in python. It can be classified broadly mutable and immutable classes. Object of immutable classes cannot be changed subsequently once it has been instantiated.
Commonly used built-in classes for Python
Note : 
1. Bool class instances are expressed as the literals True and False.
2. Numbers are mainly of two types - integers and floats. In Python, int and float classes are the primary numeric types. Default value from constructor int() is 0 and float() is 0.0.
3. In Java and c++, we have different int type based on precision. However,python automatically chooses the internal representation for an integer based upon the magnitude of its value.

Before moving ahead we will execute some code in python interpreter and predict outcome:
    >>> int(3.14)
    >>> int(-3.99)
    >>> int('137')

Operators in python:- 

Almost all operators are present in Python as in other languages, some of them needs special mention are as follows :

Comments in python:-

In python single line comment is done using # (pound).Below code uses # for comment: 
 # I am comment- it will print Hello World
  >>>print 'hello world'
  hello world
Note:  It is recommended not to use triple-quotes for block comments as it is for documentation strings not block comments, although it has a similar effect.Always use # in for single or multiple statements. 

Previous : Introduction and installation                                 Next: Python Control Flow (If-Else, While, For Loop)
Location: Hyderabad, Telangana, India


  1. This comment has been removed by the author.

  2. I am commenting to let you know what a terrific experience my daughter enjoyed reading through your web page. She noticed a wide variety of pieces, with the inclusion of what it is like to have an awesome helping style to have the rest without hassle grasp some grueling matters.
    Surya Informatics

  3. I like your post very much. It is very much useful for my research. I hope you to share more info about this. Keep posting Spark Online Training Hyderabad

  4. Excellent blog with lots of information. I have to thank for this. Do share more.

    Tally Course | Tally Institute

  5. You are doing a great job by sharing useful information about Python Programming course. It is one of the post to read and imporove my knowledge in Python Programming .You can check our Comments In Python language,for more information about Python Comments Tutorial.

  6. Travel Tours To India
    We welcome guests from all over the world and offer them a tailor-made sojourn with our country. Our guests come with expectations and leave with memories of a land, so vibrant and varied. You can choose from a wide array of ready-to-sell packaged tours covering different interests

  7. Best Realtor in Brampton
    We will help you in highly profitable insvestment in which you will let your hard earned money delivers you the best highest return on the investments.

  8. Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it. You’re doing a great job Man learn Python Online Course

  9. thanks for sharing this is really helpful for my upcoming project

  10. Enjoyed reading the article above, really explains everything in detail, the article is very interesting and effective. Thank you and good luck for the upcoming articles Python Programming Training