Day 14 of #90DaysOfDevops || Python Data Types and Data Structures for DevOps

Day 14 of #90DaysOfDevops || Python Data Types and Data Structures for DevOps

·

2 min read

What is meant by data types?

In computer language, a data type is a classification of data that determines the operations that can be performed on it and the way it is stored in memory. Data types specify the type of data that a variable can hold, and each programming language has its own set of data types.

Data types in Python

  1. Numeric data types:

    • int (integer) - whole numbers

    • float - numbers with decimal points

    • complex - numbers with a real and imaginary part

  2. Sequence data types:

    • list - ordered, mutable sequence of elements

    • tuple - ordered, immutable sequence of elements

    • range - sequence of numbers

  3. Text data type:

    • str (string) - a sequence of characters
  4. Mapping data type:

    • dict (dictionary) - collection of key-value pairs
  5. Set data type:

    • set - collection of unique elements
  6. Boolean data type:

    • bool - True or False

What is meant by data structure?

Organizing and storing data in a computer program so that it can be accessed and used efficiently. Basically data structure are designed to efficiently store, retrieve and manipulate data in a way that is optimized for specific types of operations, such as searching, sorting, inserting, or deleting data.

Data structures in Python

  1. Lists: A list is an ordered, mutable collection of elements. Lists are denoted by square brackets [ ] and each element is separated by a comma.

  2. Tuples: A tuple is an ordered, immutable collection of elements. Tuples are denoted by parentheses ( ) and each element is separated by a comma.

  3. Sets: A set is an unordered, mutable collection of unique elements. Sets are denoted by curly braces { } or the set() constructor.

  4. Dictionaries: A dictionary is an unordered, mutable collection of key-value pairs. Dictionaries are denoted by curly braces { } and each key-value pair is separated by a colon.

  5. Arrays: An array is a collection of elements of the same data type, stored in contiguous memory locations. In Python, arrays can be created using the array module.

  6. Queues: A queue is a collection of elements that follows the First-In-First-Out (FIFO) principle. Python provides a built-in queue module for creating queues.

  7. Stacks: A stack is a collection of elements that follows the Last-In-First-Out (LIFO) principle. Python provides a built-in list data type that can be used as a stack.

Here comes the end to this task.


Reach me on:

  1. Github-> https://github.com/Hrmn97

  2. Twitter -> https://twitter.com/Harman9765

  3. LinkedIn -> https://www.linkedin.com/in/chetan-harman-56310424a

  4. Website -> https://devhrmn.netlify.app/