Skip to main content

Command Palette

Search for a command to run...

Day 15: Basics of Python for DevOps Engineers

Published
2 min read
V

Hello, I started my journey as a software tester and later discovered that I am interested in DevOps. So as a transiting of career to DevOps engineer. I am practicing the #100daysofdevops Challenge for self-improvement and learning the process of DevOps. I am sharing my experience with you, you can contact me at vishalabhosale30@gmail.com

What is Python?

Python is an open-source, general-purpose, high-level, and object-oriented programming language created by Guido van Rossum. It has a vast ecosystem of libraries and frameworks, such as Django, TensorFlow, Flask, Pandas, Keras, and many more.

How to Install Python

Windows Installation

  1. Go to the Python website.

  2. Download the latest version of Python.

  3. Run the installer and follow the instructions.

  4. Check the installation by opening a command prompt and typing:

     python --version
    

Ubuntu Installation

  • sudo apt-get update

  • sudo apt-get install python

macOS Installation

  1. Download the installer from the Python website.

  2. Follow the installation instructions.

  3. Check the installation by opening a terminal and typing:

    • python3 --version

Tasks with Answers

Task 1:

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

Answer:

2. Read about different data types in Python.

  • Python supports several data types, which can be categorized as follows:

    • Numeric Types:

      • int: Integer values

        • x = 10
      • float: Floating-point values

        • y = 10.5
      • complex: Complex numbers

        • z = 3 + 5j
    • Sequence Types:

      • str: String values

        • name = "bhavin"
      • list: Ordered collection of items

        • fruits = ["apple", "banana", "cherry"]
      • tuple: Ordered, immutable collection of items

        • coordinates = (10.0, 20.0)
  • Mapping Types:

    • dict: Key-value pairs

      • person = {"name": "bhavin", "age": 24}
  • Set Types:

    • set: Unordered collection of unique items

      • unique_numbers = {1, 2, 3, 4, 5}
    • frozenset: Immutable set

      • frozen_numbers = frozenset([1, 2, 3, 4, 5])
  • Boolean Type:

    • bool: Boolean values

      • is_active = True
  • None Type:

    • NoneType: Represents the absence of a value

      • data = None

More from this blog