Day 14 Task: Python Data Types & Data Structures for Devops

Day 14 Task: Python Data Types & Data Structures for Devops

Data types in Python?

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. here are the following data types in python:

  • Numeric

  • Sequence Type

  • Boolean

  • Set

  • Dictionary

  • Binary Types

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.

List

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 is a collection of python objects much like a list but tuples are immutable in nature.

Dictionary python directory is like a hash tables in any other language with the time complexity of (1). it is unordered collection of data values, used to stored data values like a map, which unlike other data types.

Tasks:- Now let us discuss with the help of Task:

1 Give the Difference between List, Tuple and set Do hands on and put screenshots as per your understanding.

A) A list is a collection of ordered data.

B) Lists are mutable

C) Lists are declared with square braces.

Task 1 Block Diagram my_list.

Tuple:

A) A tuple is an ordered collection of data.

B) Tuples are immutable.

C) Tuples are enclosed within parenthesis.

Tuple Diagram.

Set:

A) A set is an unordered collection.

B) Sets are multi able and have no duplicate elements.

C) Sets are represented in curly brackets.

set Diagram.

2 Create a List of cloud service provider for ex:

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

Thank you for reading!!

Happy Learning !!