⚡What is Python
In the vast world of programming languages, Python stands out as a versatile and beginner-friendly option that has gained immense popularity in recent years. It is a high-level, interpreted programming language known for its simplicity, readability, and versatility. It is developed by Guido van Rossum and first released in 1991.
It has become a go-to language for a wide range of applications like -
Web development
Data Science
ML
AI
Web scraping
Automation - DevOps Task, General task (excel).
⚡How to install Python
⭐On Windows:
Python is not preinstalled in Windows OS, so you will have to install it explicitly.
- Download the latest version of Python from the official website.
2. Run the downloaded executable file and install Python.
- Make sure to mark Add Python 3.11 to PATH while the Python installer is running, otherwise, you will have to do it explicitly.
3. Once installation is completed, check the version in the command prompt.
python --version
⭐On Linux:
On most of the Linux OS, Python comes preinstalled. Check the version with the above command. Else, run the below commands to install the latest version -
$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt-get update
$ sudo apt-get install python3.11.2
⚡Data Types in Python
Python has several built-in data types that are used to store and manipulate different kinds of data. Python is a dynamically typed language, meaning you don't need to explicitly declare the data type of a variable. Python infers the data type based on the value assigned to it.
Here are the commonly used data types in Python:
1. Numeric Types:
Integer (int): Represents whole numbers without decimal points, such as 1, 10, and -5.
Float (float): Represents floating-point numbers with decimal points, such as 3.14, -0.5.
2. Boolean Type:
- Boolean (bool): Represents truth values, either True or False. Used for logical operations and conditions.
3. Sequence Types:
String (str): Represents a sequence of characters enclosed in single quotes ('') or double quotes ("").
List (list): Ordered collection of elements enclosed in square brackets ([]). Lists can contain elements of different data types and are mutable (can be modified).
Tuple (tuple): Similar to lists, but tuples are enclosed in parentheses (()). Tuples are immutable (cannot be modified once defined).
5. Mapping Type:
- Dictionary (dict): Collection of key-value pairs enclosed in curly braces ({}). Keys are unique and used to retrieve values. Dictionaries are mutable and allow for efficient lookup and manipulation.
6. Set Types:
Set (set): Unordered collection of unique elements enclosed in curly braces ({}). Sets do not allow duplicates and provide operations like union, intersection, and difference.
FrozenSet (frozenset): Similar to sets, but frozen sets are immutable (cannot be modified once defined).
7. None Type:
- None (NoneType): Represents the absence of a value or a null value. It is often used to indicate the absence of a meaningful result.
We will see examples in the next Article. 🙂
Thank you for reading! 📘