Skip to main content

Posts

Showing posts from June, 2021

Dictionary - Data type of python

  Dictionary Dictionary is one of the data structure in python, which holds a value with a key, it acts as an address book, for example just consider that while you apply ar fill different forms for the admission, each form is identified with a different name, and in the form, each column has a label, like (“Age:-_23_), here the name of the form is considered as a variable to store information, the ‘Age’ is considered as the keyword, and ‘23’ is considered as the value entered to the ‘keyword’ for  ‘Age in the inside the variable form. It is denoted by curly bracket ‘{}’. Lets try with an example Input: A = {} type(A) Output: dict # dict is the short cut for Dictonary. Input: A[‘what is your name’] = ‘jack’ A Output: {‘what is your name’ : ‘jack’} Input: A[‘what is your name’] Output: ‘Jack’ Input: A[‘jack’] ------------------------------------------------------------------------...

Tuple - Data type of python

  Tuple                              The tuple is one of the data structures in python. A tuple is used to store multiple values in a variable, but the values after once entered cannot be changed, that’s why it is called immutable. For example, just consider that, you have gone to a restaurant or a hotel, so to pay the money you will get a bill which contains price, tax, etc, the values which are entered in these variable, like price, tax, etc… can not be change cone it is printed, likewise in ‘tuple’ when the values are entered once it cannot be changed. the tuple is represented as curve becker ‘()’ . Let us try with an example Input: Hotel_bill = (10,20,22,) Hotel_bill Output: (10, 20, 22) Input: type(hotel_bill) Output: tuple Input: hotel_bill[2] Output: 22 ...

List - Data type in python

  List                       A ‘list’ one of the data structure in Python, which holds different data in order for example: Just imagine that when you are going to a store to get at least ten or twenty different products, so if you memorized all the name of different products in the mind, you might get confused or forget in-store while shopping, So instead of getting forget or confused you would store all the in a list, whereas in Python List is used to store data in a sequence manner. In Python, while writing a list you have to write the value inside the square bracket “[]” , which makes the Python interpreter understand that you are specifying a type ‘list’. After creating a list, you can add, remove, and search for any items in the list. Due to the capability of adding and removing the data in a list, it is also known as “ Mutable data type ”, which means this data can be altered. Input: Th...