Data Types

                                     Data Types in Python 


There are various types of data types which can be classified as below :

    • Every Value  is specific to any data type in python..

      Numbers


      Intergers Data Type : 1 , 2, -3, 0 




      Floats Data Type : 1.2 , 4.5 , -3.5



      Complex Number Data Type : 5 + 6i, 4 + 4i


      Output :

      In Above Example cmath module is used to print real & imaginary part of complex number ..
      Later in blog I will explain how we can write a code using module & usage of functions..

      Boolean Data Type : True and False


      == is Rational operator which compares , In above example first x = is assigned with 1 & then x is compared whether is 1 or not .. Hence Boolean Data type shows it is true or false ... Then we used type syntax to find the type of data type of True & False data type...

      Sequences 

      Strings Data Type : "ASR 1001-HX" , "vEdge" , "vManage" .. It is written inside single or double quotes.

      List Data Types : It is written between [] brackets & separated by commas & can consists of integers , strings , floats etc ..  & It is mutable by nature




      In Above Example x consists of various values enclosed with [] bracket & those values can be replace because it is mutable .. Shall cover more details of list data type later in blog..

      Tuple Data Types : It is written between () brackets & separated by commas & can consists of integers , strings , floats etc ..  & It is immutable by nature



      In Above Example x consists of various values enclosed with () bracket & those values cannot be replace because it is immutable .. Shall cover more details of list data type later in blog..

      Sets Data Types : It is written between {} brackets & separated by commas & can consists of integers , strings , floats etc .. but cannot have duplicate entries & It is immutable by nature..


      In Above Example x consists of various values enclosed with {} bracket & those values cannot be replace because it is immutable & notice duplicate entries of 1 & 2 are removed ... Shall cover more details of list data type later in blog..

      None Data Type : It is special Data type , it is neither 0 nor False ... It is used to signify the absence of value in a situation.



      Mapping

      Dictionary Data Type : It holds key value pair & it is enclosed with {} brackets & separated by : & can consists of integers , strings , floats etc ..  It is mutable by nature..


      In Above Example x consists of various key : pair values enclosed with {} bracket ... In above example Key vManage & its value 2.2.2.2 , similarly vBond is key & its value is 1.1.1.1 ... Shall cover more details of list data type later in blog..




      Comments

      Popular posts from this blog

      Mutable & Immutable Data Types