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.
Ubuntu Installation:
Open a terminal window.
Run the following command to update the package list:
sudo apt-get update
Install Python 3.11 using the following command:
sudo apt-get install python3.11
Verify the installation by typing:
python3.11 --version
Windows Installation:
Visit the official Python website at python.org.
Navigate to the "Downloads" section.
Choose the latest version of Python for Windows and download the installer.
Run the installer and make sure to check the box that says "Add Python to PATH" during installation.
Click "Install Now" to start the installation process.
Once installed, open the command prompt and type
python --version
to check the installed Python version.
Check Python Version
python --version
This command will display the installed Python version on your system.
Exploring Python Data Types
Python supports various data types, each serving a specific purpose. Here are some fundamental data types in Python:
Integers (
int
): Whole numbers without any decimal points. Example:5
,-12
.Floats (
float
): Numbers with decimal points or numbers written in scientific notation. Example:3.14
,2.5e2
.Strings (
str
): Sequences of characters enclosed in single or double quotes. Example:'Hello, Python!'
,"Data Science"
.Booleans (
bool
): Represents the truth valuesTrue
orFalse
.Lists (
list
): Ordered and mutable sequences of elements. Example:[1, 2, 3]
,['apple', 'banana', 'orange']
.Tuples (
tuple
): Ordered and immutable sequences. Example:(1, 2, 3)
,('red', 'green', 'blue')
.Dictionaries (
dict
): Unordered collections of key-value pairs. Example:{'name': 'John', 'age': 25}
.
Happy coding!