Day 15: ๐Ÿ Basics of Python for DevOps Engineers ๐Ÿš€

Day 15: ๐Ÿ Basics of Python for DevOps Engineers ๐Ÿš€

ยท

2 min read

Day 15 Task:

Let's start with the basics of Python, as this is also important for DevOps Engineers to build logic and programs.

What is Python?

  • Python is an open-source, general-purpose, high-level, and object-oriented programming language.

  • It was created by Guido van Rossum.

  • Python consists of vast libraries and various frameworks like Django, TensorFlow, Flask, Pandas, Keras, etc.

How to Install Python?

You can install Python on your system, whether it is Windows, macOS, Ubuntu, CentOS, etc. Below are the links for the installation:

Tasks

Task 1:

  1. Install Python on your respective OS, and check the version.

  2. Read about different data types in Python.

Steps for python installation in ubuntu cli :

sudo apt update

sudo apt-get install python3.6

python3 #file

1.Checking python version

2.Data Type in python

Python has several built-in data types that are essential for programming. Here are the main ones:

  1. Numeric Types:

    • int: Integer type, e.g., 5, -10

    • float: Floating-point number, e.g., 3.14, -2.0

    • complex: Complex number, e.g., 1+2j, 3-4j

  2. Sequence Types:

    • str: String type, e.g., "Hello, World!"

    • list: List type, e.g., [1, 2, 3, "a", "b", "c"]

    • tuple: Tuple type, e.g., (1, 2, 3, "a", "b", "c")

  3. Mapping Type:

    • dict: Dictionary type, e.g., {"name": "Alice", "age": 25}
  4. Set Types:

    • set: Set type, e.g., {1, 2, 3, "a", "b", "c"}

    • frozenset: Immutable set type, e.g., frozenset([1, 2, 3, "a", "b", "c"])

  5. Boolean Type:

    • bool: Boolean type, e.g., True, False
  6. Binary Types:

    • bytes: Immutable byte sequences, e.g., b"hello"

    • bytearray: Mutable byte sequences, e.g., bytearray(b"hello")

    • memoryview: Memory view object, e.g., memoryview(b"hello")

  7. None Type:

    • NoneType: Represents the absence of a value, e.g., None

These data types are fundamental to Python and are used to store and manipulate data in various ways.

Thank you for reading!

ยฉ 2024 Anand Raval. All rights reserved.

ย