Day13 of #90daysofdevops | Python Fundamentals for DevOps
Table of contents
Let's Start with Basics of Python as this is also important for DevOps Engineer to build the logic and Programs.
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.
Here are some key features of Python:
Easy to Learn and Use: Python is designed to be easy to read and write, with a syntax that allows developers to express concepts in fewer lines of code than might be used in languages such as C++ or Java.
Interpreted Language: Python code is executed line by line, which makes debugging easier but can result in slower execution compared to compiled languages.
Dynamically Typed: There is no need to declare the type of variable while programming. The type (e.g., integer, string, list) is determined at runtime.
Extensive Standard Library: Python comes with a large standard library that includes modules and packages for a wide range of tasks, from mathematical computations to web services.
Open Source and Community: Python is an open-source programming language supported by a large community of developers who contribute to the ever-growing repository of modules and tools.
Portability: Python programs are portable, meaning that they can run on various kinds of hardware and have the same interface on all platforms.
Wide Range of Applications: Python is used in numerous domains, such as web development (e.g., Django, Flask), data analysis (e.g., pandas, NumPy), artificial intelligence and machine learning (e.g., TensorFlow, Scikit-learn), scripting, and automation.
Integrated Development Environments (IDEs): Python can be used in a variety of IDEs like PyCharm, VSCode, Jupyter Notebook, and others, which provide powerful programming and debugging tools.
Python offers a valuable set of features that can be effectively utilized across different fields of software development.
How to Install Python?
You can install Python in your system whether it is Windows, macOS, Ubuntu, Centos etc. Here's the link for Python installation:
https://www.python.org/downloads/
Ubuntu: sudo apt-get install Python3.6
Install Python and check the version
In Linux(Ubuntu), write sudo apt-get install python3.6
command and the python will install automatically. You don't need to click on next to install the packages in Linux. After the installation, write the python --version
command to check the current version of the python you are using. Simple as that in Linux.
Data Types in Python
Data types are defined as which type of type of value a variable can hold. Python is dynamically typed, which means you don't need to define the data type of the variable. Instead, Python determines the data type based on the assigned value. Here are some data types in Python:
Integer (int): Represents whole numbers, both positive and negative, without a decimal point. For example,
42
or-17
.Float (float): Represents real numbers with a decimal point or in exponential form. For example,
3.14
or1.5e-5
.String (str): Represents a sequence of characters enclosed in single, double, or triple quotes. For example,
'Hello, World!'
or"Python"
.Boolean (bool): Represents either
True
orFalse
. Used for logical operations and conditional statements.List: A collection of ordered mutable elements enclosed in square brackets (
[]
). Lists can contain elements of different data types.
There are more data types in Python, and I choose these for the basic knowledge of Python. These data types are fundamental in Python and provide flexibility for various programming tasks. Python's dynamic typing allows the variable to change its data type as needed during program execution.
Thank you and follow me to join me in the journey of learning DevOps
Subscribe to my newsletter
Read articles from AVINASH SARJERAO POWAR directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by