Basics of Python for Devops Engineer

Basics of Python for Devops Engineer

ยท

2 min read

What is Python?

  • Python is a 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.

Installing Python and Checking Version:

On Linux (Ubuntu):

  1. Open a terminal.

  2. Run the following command to install Python:

     sudo apt update
     sudo apt install python3
    
  3. To check the installed version, run:

     python3 --version
    

On macOS:

  1. Open a terminal.

  2. You may already have Python installed. To check the version, run:

     python3 --version
    

On Windows:

  1. Download the Python installer from the official Python website: Python Downloads.

  2. Run the installer and follow the prompts to install Python.

  3. After installation, open Command Prompt.

  4. To check the installed version, run:

     python --version
    

    Python supports several built-in data types :

    1. Numeric Types:

      • int: Integer numbers (e.g., 5, -10).

      • float: Floating-point numbers (e.g., 3.14, -0.001).

    2. Sequence Types:

      • str: Strings (e.g., "hello", 'world').

      • list: Ordered collections of items (e.g., [1, 2, 3]).

      • tuple: Immutable ordered collections (e.g., (1, 2, 3)).

    3. Mapping Types:

      • dict: Key-value pairs (e.g., {'name': 'John', 'age': 30}).
    4. Set Types:

      • set: Unordered collections of unique items (e.g., {1, 2, 3}).
    5. Boolean Type:

      • bool: Represents True or False.

Conclusion:

In this brief blog post, we covered Python's built-in data types and the installation process. Python offers a variety of data types, including numeric, sequence, mapping, set, boolean, and None types, providing versatility for data manipulation. Additionally, we provided quick installation instructions for Linux, macOS, and Windows. Python's simplicity and rich features make it an indispensable tool for programmers at all levels, empowering them to tackle diverse coding tasks with ease and efficiency.

Happy Learning, Ruko Mat Phod do๐Ÿ˜ƒ

ย