Python Tutorial – Python is one of the most popular programming languages.
It’s simple to
use, packed with features and supported by a wide range of libraries and frameworks. Its
clean syntax makes it beginner-friendly.
Python is:
A high-level language, used in web development, data science, automation, AI and
more.
Known for its readability, which means code is easier to write, understand and
maintain.
Backed by library support, so we don’t have to build everything from scratch, there’s
probably a library that already does what we need.
Why to Learn Python?
Python requires fewer lines of code compared to other programming languages.
Python is in high demand as it provides many job opportunities in Software
Development, Data Science and AI/ML.
Python provides popular Web Development, AI/ML, Data Science and Data Analysis
Libraries like Django, Flask, Pandas, Tensorflow, Scikit-learn and many more.
Python is an object oriented programming language which encapsulates code within
object.
Python is cross-platform which works on Windows, Mac and Linux without major
changes.
Python is used by big companies like Google, Netflix and NASA.
First Python Program
Here is a simple Python code, printing a string. We
recommend you to edit the code and try to print your own
name.
print("Hello World")
Output
Hello World
INSTALLATION OF PYTHON
[Link]
Key Features of Python
Python’s simple and readable syntax makes it beginner-friendly.
Python runs seamlessly on Windows, macOS and Linux.
Includes libraries for tasks like web development, data analysis and machine learning.
Variable types are determined automatically at runtime, simplifying code writing.
Supports multiple programming paradigms, including object-oriented, functional and
procedural programming.
Python is free to use, distribute and modify.
Understanding Hello World Program in Python
Hello, World! in python is the first python program which we learn when
we start learning any program. It’s a simple program that displays the
message “Hello, World!” on the screen.
How does this work:
print() is a built-in Python function that tells the computer to show something on the
screen.
The message "Hello, World!" is a string, which means it's just text. In Python, strings
are always written inside quotes (either single ' or double ").
Anything after # in a line is a comment. Python ignores comments when running the
code, but they help people understand what the code is doing.
Comments are helpful for explaining code, making notes or skipping lines while
testing.
We can also write multi-line comments using triple quotes:
"""
This is a multi-line comment.
It can be used to describe larger sections of code.
"""
Indentation in Python
In Python, Indentation is used to define blocks of code. It tells the Python interpreter that a
group of statements belongs to a specific block. All statements with the same level of
indentation are considered part of the same block. Indentation is achieved using whitespace
(spaces or tabs) at the beginning of each line.
Example:
if 10 > 5:
print("This is true!")
print("I am tab indentation")
print("I have no indentation")