Introduction to
programming with
python
What is Python?
High-level, versatile, and popular programming
language.
Used for web development, data science, automation,
etc.
Why Learn Python?
Simple and readable syntax.
Extensive libraries and active community.
IDE Setup
Use VS Code, PyCharm, or online tools like
Replit/Jupyter.
Basic Syntax & Variables
Printing to the Console: print("Hello, World!")
Variables and Data Types
Strings: "Hello"
Integers: 25
Floats: 5.6
Booleans: True, False
Example Code
Control Flow – If-else Statements
Decision Making with If-Else
Check conditions and execute different code paths.
Syntax:
Example:
Logical Operators:
and, or, not
Solution:
Loops – For and While
For Loop:
Repeat tasks a specific number
of times.
Syntax:
While Loop:
Repeat while a condition is true.
Syntax:
Example:
Solution:
Functions
What Are Functions?
Blocks of reusable code.
Syntax:
Example:
Why Use Functions?
Organize and reuse code easily.
Built-in Functions
Common Built-in Functions:
len(): Get the length of an object.
max(), min(), sum(): Work with numbers and lists.
Solution:
Solution:
Try it yourself: