# Python Data Types [Day 14 Task]

## **Python Data Types:**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691782828166/8d9a58a1-d67e-46e8-9930-33407a3bd2c0.png align="center")

* ### **1.Difference between List, Tuple, and Set**
    
    1\. A **<mark>list</mark>** is an ordered collection of similar or different types of items separated by commas and enclosed within brackets <mark>[ ]</mark>.
    
    The **<mark>Set</mark>** is an unordered collection of unique items. Set is defined by values separated by commas inside braces <mark>{ }.</mark>
    
    **<mark>Tuple</mark>** is an ordered sequence of items same as a list. The only difference is that tuples are immutable. Tuples once created cannot be modified.
    
* **2**. A **<mark>list</mark>** refers to a data structure of a non-homogenous type that functions to store various elements in columns, multiple rows, and single rows.
    
    A **<mark>tuple</mark>** also refers to a data structure of the non-homogenous type that functions to store various elements in columns, multiple rows, and single rows.
    
    A **<mark>set</mark>** also refers to a data structure of the non-homogenous type, but it stores various elements in a single row.
    
* **3.** **<mark>Lists</mark>** allow various duplicate elements.
    
    **<mark>Tuple</mark>** allows various duplicate elements.
    
    The **<mark>set</mark>** does not allow any duplicate elements.
    
* **4.** We can create a list using the **<mark>list()</mark>** function.
    
    We can create a tuple using the **<mark>tuple()</mark>** function.
    
    We can create a set using the **<mark>set()</mark>** function.
    
* **5.** **<mark>List</mark>** is mutable. It means that a user can make any changes to a list
    
    **<mark>Tuple</mark>** is immutable. It means that a user can’t make any changes to a tuple.
    
    The **<mark>Set</mark>** is mutable. It means that a user can make any changes to a set.
    
* 6\. If we want to create an **<mark>empty list</mark>**, we use: **l=\[\]**
    
    If we want to create an **<mark>empty tuple</mark>**, we use:
    
    **t=()**
    
    If we want to create an **<mark>empty set</mark>**, we use:
    
    **a=set()**
    
    **b=set(a)**
    
* ### **2\. Create the below Dictionary and use Dictionary methods to print your favorite tool just by using the keys of the Dictionary.**
    
    ### <mark>fav_tools = { 1:"Linux", 2:"Git", 3:"Docker", 4:"Kubernetes", 5:"Terraform", 6:"Ansible", 7:"Chef" }</mark>
    
    First, create a dictionary and then print it. To execute a python file **python followed by file name**.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691782986885/9afd7607-fa07-43c6-9435-52241e76e837.png align="center")
    
    ### **3\. Create a List of cloud service providers eg.**
    
    ### **<mark>cloud_providers = ["AWS","GCP","Azure"]</mark>**
    
    To access items from a list, we use the index number (0, 1, 2 ...). So here I print **Azure \[2\]**
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691783026688/af69c524-7a79-4303-95c1-f98396ce2f8d.png align="center")
    
    ### **4\. Write a program to add Digital Ocean to the list of cloud\_providers and sort the list in alphabetical order**
    
    Just add Digital\_Ocean to the list and **sort(by default it is set to ascending order)** the cloud provider by using the **sort()** function.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691783057764/ed85caf1-1d15-43e2-8b95-2bbb0313656c.png align="center")
