PYTHON PROGAMMING LANGUAGE
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.
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?
Requires fewer lines of code compared to other programming languages like Java.
Provides Libraries / Frameworks like Django, Flask and many more for Web
Development, and Pandas, Tensorflow, Scikit-learn and many more for, AI/ML, Data
Science and Data Analysis
Cross-platform, works on Windows, Mac and Linux without major changes.
Used by top tech companies like Google, Netflix and NASA.
Many Python coding job opportunities in Software Development, Data Science and
AI/ML.
First Python Program
Here is a simple Python code, printing a string.
1. Python Basics
In this section, we’ll cover the basics of Python programming, including installing Python,
writing first program, understanding comments and working with variables, keywords and
operators.
Python Introduction
Python was created 1991 with focus on code readability and express concepts in fewer
lines of code.
Simple and readable syntax makes it beginner-friendly.
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.
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:
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. The most common convention
is to use 4 spaces or a tab, per level of indentation.
Explanation:
first print statement has no indentation, so it is correctly executed.
second print statement has tab indentation, but it doesn't belong to a new block of
code. Python expects the indentation level to be consistent within the same block.
This inconsistency causes an IndentationError.
Application Built using Python
YouTube: World’s largest video-sharing platform uses Python for features like video
streaming and backend services.
Instagram: This popular social media app relies on Python’s simplicity for scaling and
handling millions of users.
Spotify: Python is used for backend services and machine learning to personalize
music recommendations.
Dropbox: The file hosting service uses Python for both its desktop client and server-
side operations.
Netflix: Python powers key components of Netflix’s recommendation engine and
content delivery systems (CDN).
Google: Python is one of the key languages used in Google for web crawling, testing
and data analysis.
Uber: Python helps Uber handle dynamic pricing and route optimization using
machine learning.
Pinterest: Python is used to process and store huge amounts of image data
efficiently.
What can we do with Python?
Python is used for:
Web Development: Frameworks like Django, Flask.
Data Science and Analysis: Libraries like Pandas, NumPy, Matplotlib.
Machine Learning and AI: TensorFlow, PyTorch, Scikit-learn.
Automation and Scripting: Automate repetitive tasks.
Game Development: Libraries like Pygame.
Web Scraping: Tools like BeautifulSoup, Scrapy.
Desktop Applications: GUI frameworks like Tkinter, PyQt.
Scientific Computing: SciPy, SymPy.
Internet of Things (IoT): MicroPython, Raspberry Pi.
DevOps and Cloud: Automation scripts and APIs.
Cybersecurity: Penetration testing and ethical hacking tools.