Python Programming - DataType

Posted by Aditya Nema 2 Comments
Hello All, In the last article we discuss the python introduction. Today we will be going to discuss the datatype used in python. The datatype is one of the most important concept in programming. Let us discuss that :

Datatype in any programming language is mostly of two types one is the built-in data type and the other is user-defined datatype. 

The user-defined data type includes class and all we will discuss this in more detail in upcoming articles.

The following is the built-in data types used in python :

  • Text type:            str
  • Numeric Type:    int, float, complex
  • Sequence Type:  list, tuple, range
  • Mapping Type:   dict
  • Set Type:            set, frozenset
  • Binary Type:    Byte, Bytesarray, memoryview

We will discuss all these data types in our upcoming articles.

As already discussed there s a built-in function known as the type() which is used to identify the type of data store in the variable. In very simple words datatype is nothing but the type of data variable holds. There can be any type of data as a string of characters, integer, decimal, etc.

All these words like list, dict, etc are reserved words known as keywords. This set of words is reserved and you cannot use them as the name of variable, function, class, etc.

Let us move towards our first program known as a simple hello program. In python command line just type as per the image below

>>>print("hello")>>>hello

The print is the built-in function used to print the values. Whatever you write between the double quotes will be printed on the screen.

The below code will illustrate how to define the variable and do the basic addition operation in python.

>>> # defining the variables 
>>> a = 7
>>> b = 8
>>> # sum the variable and store it in another variable
>>> c = a+b
>>> #display the result
>>> print(c)
>>>15

In the next article, we will discuss different types of operators.
Read More

Python Programming Language - Introduction

Posted by Aditya Nema 2 Comments
Hello all, in this article we will discuss something about python. Python is a very powerful object-oriented programming language. Nowadays it is used extensively in many fields. It has many powerful libraries which allow you to do several different functions. Before starting this I assume you know the basics of OOP's. Python was discovered in 1980 by Guido van Rossum in Netherland. Python is a very simple language we will start first by declaring the variable. I am again assuming you have Python 3 installed in your system if not you can download it from here https://www.python.org/downloads/. You can also use the IDE like Pycharm. So let start with our very first thing declaring the variable :
        
                                                                      a = 1 
  • Here a is the variable name.1 is the value python automatically consider a as the integer datatype by just seeing its value.
  • You can check the data type of a by just typing the following command  
                                                                 print(type(a))
  • Here the print function is used to print the value on console.
  • Type is a function that returned the datatype of the variable.                                                                                                                                                                                                                           
  • Variable is nothing but the memory location used to hold the values throughout the life of the program
The above example illustrates how simple is this. Technical details we will look more in upcoming articles.      

Why python is so popular?

It is popular because of its simplicity. It has many packages available for different purposes. You can directly use the features of those packages just by importing them into your program. One such package is pandas. It is widely used for data analysis and data processing.

Who has to learn python?

Simple answer anybody who is interested or working professionals who want to switch their career in the field of python. Nowadays it is widely used in data processing so many people who want to become data scientists need to have a basic knowledge of python.


This is all, for now, we will look at the datatype in the next article


Read More
back to top