DS051023 ( Data types Introduction

Python - python is a high level, general purpose, object oriented programming language.

It is an interpreted language. Guido van rossam has developed python language and released in the year 1991.

It is free and open source language.

It is a case sensitive language, alphabets in lower case and upper case are considered as different characters.

Python has different application like data science, data mining, web applications, mobile applications

data visualization, machine learning etc.

-------------------------- comments --------------------------------------------

single line comments

‘’’
This
is
a
multiline
comment
‘’’

--------------------------- Datatypes -------------------------------------------------

‘’’
Data - A piece of information.

Datatypes - it is the classification of the data items.

  1. Numeric :

    1. integer - It is a whole number, it can be either positive, negative or zero but it does not include any
      fractional part. e.g 10,14,1234566, -43, -587.

    2. float - it is a decimal number. e.g 23.0 , 44.4324 , -123.2341.

    3. complex - It is used for working with complex numbers, here the imaginary part is represented by ‘j’.
      e.g 4+ 6j, 2 + 4j.

  2. Sequence :

    1. string - It is a collection of characters (numbers, alphabets, special symbols and spaces) kept in
      single or double quotes. It can have any number of characters or it can be empty also.
      a string of one character is called a string of length 1.
      e.g. “” , “a”, ‘apple’, “aljuboh1234@#34%^”.

    2. list : It is a heterogenous collection of data items seperated by comma. It is mutable and
      represented by []. e.g [12,14,18,“strings”,10.00,12.123,654].

    3. tuple : It is a heterogenous collection of data items seperated by comma. It is immutable and represented
      by () . e.g (10,122.123, “abhc”, “xyz”)

  3. Boolean : It is a datatype with two values i.e True and False.
    0 - False, any non-zero number - True,
    empty string - False, non-empty string - True
    empty list - False, non-empty list - True
    empty tuple - False, non-empty tuple - True
    e.g True, False, 0, 1

  4. Set : It is an unordered collection of unique elements/data items, It is mutable and does not allow any duplicates.
    it is represented by {}. e.g {10,15,12,13,15,16} — {10,15,12,13,16}

  5. Dictionary (dict) : It is an collection of data items which are kept in pairs (key-value pairs)
    and every key value pair is seperated by comma.
    e.g {1 : “one” , “two” : 2 , 3 : [1,2,3,4], 10.43 : 12345}

  6. Binary Datatype : it is used for working with binary data.

    1. memory view -
    2. bytearray -
    3. bytes -
      string = “abc”
      bites = bytes(“abc”)
      array_bytes = bytearray(“abc”)
      memory_view = memoryview(array_bytes)

‘’’