Python Basics for DevOps Beginners | Variables, Data Types & Input Explained Simply
After a basic introduction to Python, I started exploring new things in the Python language. As a DevOps engineer, Python is one of the most important tools for automation, scripting, and daily tasks. In this blog, I will explain Python in a very simple and practical way so anyone can understand it easily.
Step 1: Check Python Version
First, open Command Prompt (CMD) or Terminal.
Run the following command:
python --versionThis command is used to check whether Python is installed and which version you are using.
Step 2: Enter Python Terminal
Now type:
pythonYou will enter the Python interactive terminal.
Try this:
2 + 2Output will be:
4This shows how easy and readable Python is.
👉 What’s happening here?
Python sends your instruction to the Operating System (OS). The OS processes it and returns the output.

What Is Code?
Code is simply a set of instructions given to the computer.
For example:
5 + 5The OS processes this instruction and gives the output:
10If the computer understands the syntax, it works fine. Otherwise, it shows a syntax error.
Printing Output on the Screen
If you want to print something on the screen, Python makes it very easy.
Example:
print("Hi Python for the DevOps")Output:
Hi Python for the DevOpsUnderstanding the Function
printis a function- Syntax of a function:
function_name()Whatever you write inside the brackets will be displayed on the screen.
Variables Explained (Very Simple)
Variable means something that can change.
Example:
num = 2You can change the value anytime:
num = 3
num = 4Constant Concept
If a value does not change, we treat it like a constant.
Example:
num1 = 2Here, we intend not to change num1.
Python Data Types
Python mainly uses these 4 basic data types:
1. Integer (int)
Whole numbers:
1, 2, 3, 4, 52. Float (float)
Decimal numbers:
2.2, 4.5, 6.53. String (str)
Anything inside quotes:
name = "Raees - Briller Technologies"Strings can be written using:
" "' '
4. Boolean (bool)
Only two values:
True
False⚠️ Python is case-sensitive
false❌ → Syntax ErrorFalse✅ → Correct
Checking Data Type Using type() Function
Python helps you learn itself using built-in functions.
Example:
num = 2
type(num)Output:
<class 'int'>Another example:
name = "Raees"
type(name)Output:
<class 'str'>Boolean example:
walk = True
type(walk)Output:
<class 'bool'>Taking Input from the User
Now let’s take input from the user.
name = input("Enter your name: ")User enters:
RaeesNow check:
nameOutput:
Raees👉 The value entered by the user is stored in the variable name.
What Is Casting?
Casting means converting one data type into another.
Example:
num1 = input("Enter first number: ")
type(num1)Output:
<class 'str'>👉 Input is always taken as a string by default.
Converting String to Integer (Casting)
num1 = int(input("Enter first number: "))Enter:
1500Now check:
type(num1)Output:
<class 'int'>✔️ This conversion is done using casting.
Simple Calculator Example
num1 = int(input("Enter first number: "))
num2 = int(input("Enter second number: "))num1 + num2
num1 - num2
Now Python works like a calculator.
Just enter values and get results according to your needs.
Final Thoughts
Python is:
- Easy to read
- Easy to write
- Very powerful for DevOps automation
If you are starting your DevOps journey, Python should be your first scripting language.
✨ I hope you liked my blog.
Please share it with others and keep following me for more DevOps and Python content.
— Raees Yaqoob Qazi
DevOps Engineer | Briller Technologies 🚀
🌐 Online References
- LinkedIn:
https://www.linkedin.com/in/raees-yaqoob-qazi-ryqs/
- Medium Blog:
https://medium.com/@raeesyaqubqazi
- Blogspot:
https://brillertechnologies.blogspot.com/
- Facebook Page:
https://web.facebook.com/profile.php?id=61553548371216
- YouTube Channel:
https://www.youtube.com/@RaeesQ.
- TikTok:
https://www.tiktok.com/@mrryqs?_t=ZS-8y7t0fQfJKu&_r=1
Comments
Post a Comment