Day12/90DaysofDevOps Challenge-Basics Of Python For DevOps Engineer
Let's Start with the Basics of Python as this is also important for DevOps Engineer to build logic and Programs.
Python has become a popular programming language in the field of DevOps due to its versatility, ease of use, and powerful capabilities. As a DevOps engineer, mastering Python can significantly enhance your ability to automate tasks, manage infrastructure, and streamline workflows.
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's simple, easy-to-learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse. The Python interpreter and the extensive standard library are available in source or binary form without charge for all major platforms and can be freely distributed. Python consists of vast libraries and various frameworks like Django, TensorFlow, Flask, Pandas, Keras etc.
It is used for:
Installing Python on Different Operating Systems:
Windows Installation:
Ubuntu Installation:
python3 - version
sudo apt-get update
sudo apt-get install python3
领英推荐
Mac Installation:
python3 - version
Congratulations! You now have Python up and running on your machine.
Let’s move on to the exciting world of Python data types.
Different Data Types in Python and How to Use Them
Python supports various data types that empower us to handle diverse information. Here are some commonly used ones:
※ Integers (int): Whole numbers without a fractional component.
Example: x = 10
※Floating-Point Numbers (float): Numbers with a fractional part.
Example: y = 3.14
※Strings (str): Sequences of characters enclosed in single or double quotes. Example: name = “DevOps”
※Lists: Ordered collections that can contain elements of different data types. Example: fruits = [“apple”, “banana”, “cherry”]
※Tuples: Immutable ordered collections similar to lists. Example: colors = (“red”, “green”, “blue”)
※Dictionaries: Key-value pairs that store data with unique keys.
Example: person = {“name”: “Alice”, “age”: 30}