Day 14 Task: Python Data Types and Data Structures for DevOps

Day 14 Task: Python Data Types and Data Structures for DevOps

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

To check what is the data type of the variable used, we can simply write:?your_variable=100?type(your_variable)

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 Hands-on and put screenshots as per your understanding.

List:

  • A list is a collection of?ordered?data.
  • Lists are?mutable.
  • Lists are declared with square braces.

No alt text provided for this image

Tuple:

  • A tuple is an?ordered?collection of data.
  • Tuples are?immutable.
  • Tuples are enclosed within parenthesis.

No alt text provided for this image

Set:

  • A set is an?unordered?collection.
  • Sets are?mutable?and have?no duplicate elements.
  • Sets are represented in curly brackets.

No alt text provided for this image

2.Create below Dictionary and use Dictionary methods to print your favourite tool just by using the keys of the Dictionary.

No alt text provided for this image

3. Create a List of cloud service providers eg.

cloud_providers = ["AWS","GCP","Azure"]        

Write a program to add?Digital Ocean?to the list of cloud_providers and sort the list in alphabetical order.

No alt text provided for this image

Thank you for reading!

要查看或添加评论,请登录

Sayali Shewale的更多文章

  • DevOps Project-3

    DevOps Project-3

    Project Description The project involves hosting a static website using an AWS S3 bucket. Amazon S3 is an object…

    7 条评论
  • DevOps Project-2

    DevOps Project-2

    Project Description The project is about automating the deployment process of a web application using Jenkins and its…

    2 条评论
  • Day 80: DevOps Project-1

    Day 80: DevOps Project-1

    Project Description The project aims to automate the building, testing, and deployment process of a web application…

    4 条评论
  • Day 73 - Setup Grafana on AWS EC2 Instance

    Day 73 - Setup Grafana on AWS EC2 Instance

    Task: Setup grafana in your local environment on AWS EC2. Go to the AWS console and Launch an EC2 instance Open port…

    2 条评论
  • Day 72 - Grafana

    Day 72 - Grafana

    What is Grafana? Grafana is an open-source data visualization and monitoring tool that allows you to query, visualize…

    3 条评论
  • Day 70 - Terraform Modules

    Day 70 - Terraform Modules

    Modules are containers for multiple resources that are used together. A module consists of a collection of .

    2 条评论
  • Day 69 - Meta-Arguments in Terraform

    Day 69 - Meta-Arguments in Terraform

    When you define a resource block in Terraform, by default, this specifies one resource that will be created. To manage…

    1 条评论
  • Day 68 - Scaling with Terraform

    Day 68 - Scaling with Terraform

    Understanding Scaling Scaling is the process of adding or removing resources to match the changing demands of your…

  • Day 67: AWS S3 Bucket Creation and Management using terraform

    Day 67: AWS S3 Bucket Creation and Management using terraform

    AWS S3 Bucket Amazon S3 (Simple Storage Service) is an object storage service that offers industry-leading scalability,…

    1 条评论
  • Day 66 - Terraform Hands-on Project - Build Your Own AWS Infrastructure with Ease using Infrastructure as Code (IaC)

    Day 66 - Terraform Hands-on Project - Build Your Own AWS Infrastructure with Ease using Infrastructure as Code (IaC)

    Task: 1.Create a VPC (Virtual Private Cloud) with CIDR block 10.

    3 条评论

社区洞察

其他会员也浏览了