# #Devops Day14

Hello, Everyone, This is my 14 blog started my day14 as AWS DevOps Engineer #90daysofchallenge with ShubhamLondhe #devops #trainwithshubham.

## Python Data Types and Data Structures for DevOps

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707226217584/16197a75-267b-45a0-8f84-40ed06fd736c.png align="center")

### Data Types

* Data types are the classification or categorization of data items. It represents the kind of value that tells what operations can be performed on a particular data.
    
* Since everything is an object in Python programming, data types are actually classes and variables are instance (object) of these classes.
    
* Python has the following data types built-in by default: Numeric(Integer, complex, float), Sequential(string ,lists, tuples), Boolean, Set, Dictionaries, etc
    

### Data Structures

Data Structures are a way of organizing data so that it can be accessed more efficiently depending upon the situation. Data Structures are fundamentals of any programming language around which a program is built. Python helps to learn the fundamental of these data structures in a simpler way as compared to other programming languages.

* Lists Python Lists are just like the arrays, declared in other languages which is an ordered collection of data. It is very flexible as the items in a list do not need to be of the same type
    
* Tuple Python Tuple is a collection of Python objects much like a list but Tuples are immutable in nature i.e. the elements in the tuple cannot be added or removed once created. Just like a List, a Tuple can also contain elements of various types.
    
* Dictionary Python dictionary is like hash tables in any other language with the time complexity of O(1). It is an unordered collection of data values, used to store data values like a map, which, unlike other Data Types that hold only a single value as an element, Dictionary holds the key: value pair. Key-value is provided in the dictionary to make it more optimized
    

## Tasks

1. Give the Difference between List, Tuple and set. Do Handson and put screenshots as per your understanding.
    
    Ans:-
    
    **List:**
    
    \-&gt;A list is an ordered collection of items, and it allows duplicate values.
    
    \-&gt;Lists are mutable, which means you can change, add, or remove elements after the list is created.
    
    \-&gt;Lists are defined using square brackets (\[\]).
    
    \-&gt; E.g.-&gt;
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707226897142/001a203e-00c6-4cc5-8336-833f5c819a84.png align="center")
    
    When you run this code, the output will be:
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707226951385/94b519cd-1d48-49fb-aec7-945859f1de73.png align="center")
    
    1. **Tuple:**
        
        \-&gt;A tuple is similar to a list, but it is immutable, which means you cannot change its elements after it is created.
        
        \-&gt;Tuples are typically used to store a sequence of related data.
        
        \-&gt;Tuples are defined using parentheses (()).
        
        \-&gt;Example:
        
        ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707227322406/38166213-eca7-431b-9698-d4398b3e7cc9.png align="center")
        
        When you run this code, the output will be:
        
        ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707227373275/e909f65c-d635-48fb-acef-e871f8d097ff.png align="center")
        
        1. **Set:**
            
            \-&gt;A set is an unordered collection of unique elements.
            
            \-&gt;Sets do not allow duplicate values, and the order of elements is not guaranteed.
            
            \-&gt;Sets are useful when you want to store a collection of items, but you don't care about their order or duplicates.
            
            \-&gt;Sets are defined using curly braces ({}) or the `set()` function.
            
            \-&gt; E.g.
            
            ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707227808856/6dfbd64f-9c72-4ffa-9031-01daf35e4935.png align="center")
            
            When you run this code, the output will be
            
            ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707227848448/d4cfdb80-4864-4745-a0b7-2f109538061f.png align="center")
            
    2. Create below Dictionary and use Dictionary methods to print your favourite tool just by using the keys of the Dictionary.
        
        \-&gt;Now, let's move on to the dictionary task.
        
        \-&gt;To print your favorite tool using the keys of the dictionary, you can use the following code
        
        ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707230689510/db3db596-0261-4480-8d4d-f03417733e34.png align="center")
        
        When you run this code, the output will be
        
        ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707230740261/28821879-6266-4dda-bb7f-5ff34fae2b83.png align="center")
        
        ### **3\. Create a List of cloud service providers e.g.**
        
        \-&gt;Moving on to the next task, to add "Digital Ocean" to the list of cloud\_providers and sort the list in alphabetical order, you can use the following code:
        
        \-&gt; First, we define a list called cloud\_providers with three initial elements: "AWS", "GCP", and "Azure".
        
        \-&gt; We use the `append()` method to add the string "Digital Ocean" to the cloud\_providers list. This method appends the specified element to the end of the list.
        
        \-&gt; Next, we use the `sort()` method to sort the elements of the cloud\_providers list in alphabetical order. The `sort()` method modifies the list in place.
        
        \-&gt;Finally, we use the `print ()` function to display the sorted list of cloud providers.
        
        \-&gt;Write a program to add `Digital Ocean` to the list of cloud\_providers and sort the list in alphabetical order :-
        
        ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707228568248/5f488aa9-e9d0-4413-aabc-6ef468d50de1.png align="center")
        
        When you run this code, the output will be:-
        
        ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707228642233/f0d16286-951d-4986-aa92-573748a428e0.png align="center")
