Day 15 Task:
Let's start with the basics of Python, as this is also important for DevOps Engineers to build logic and programs.
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 consists of vast libraries and various frameworks like Django, TensorFlow, Flask, Pandas, Keras, etc.
How to Install Python?
You can install Python on your system, whether it is Windows, macOS, Ubuntu, CentOS, etc. Below are the links for the installation:
Ubuntu:
apt-get install python3.6
Tasks
Task 1:
Install Python on your respective OS, and check the version.
Read about different data types in Python.
Steps for python installation in ubuntu cli :
sudo apt update
sudo apt-get install python3.6
python3 #file
1.Checking python version
2.Data Type in python
Python has several built-in data types that are essential for programming. Here are the main ones:
Numeric Types:
int: Integer type, e.g.,
5
,-10
float: Floating-point number, e.g.,
3.14
,-2.0
complex: Complex number, e.g.,
1+2j
,3-4j
Sequence Types:
str: String type, e.g.,
"Hello, World!"
list: List type, e.g.,
[1, 2, 3, "a", "b", "c"]
tuple: Tuple type, e.g.,
(1, 2, 3, "a", "b", "c")
Mapping Type:
- dict: Dictionary type, e.g.,
{"name": "Alice", "age": 25}
- dict: Dictionary type, e.g.,
Set Types:
set: Set type, e.g.,
{1, 2, 3, "a", "b", "c"}
frozenset: Immutable set type, e.g.,
frozenset([1, 2, 3, "a", "b", "c"])
Boolean Type:
- bool: Boolean type, e.g.,
True
,False
- bool: Boolean type, e.g.,
Binary Types:
bytes: Immutable byte sequences, e.g.,
b"hello"
bytearray: Mutable byte sequences, e.g.,
bytearray(b"hello")
memoryview: Memory view object, e.g.,
memoryview(b"hello")
None Type:
- NoneType: Represents the absence of a value, e.g.,
None
- NoneType: Represents the absence of a value, e.g.,
These data types are fundamental to Python and are used to store and manipulate data in various ways.
Thank you for reading!
ยฉ 2024 Anand Raval. All rights reserved.