1️⃣ What is Python?
Python is a high-level programming language used to tell the computer what to do.
✔ Easy to read
✔ Easy to write
✔ Used by beginners and professionals
Real-life use:
Software development
Websites (Google, Instagram)
Data analysis
Artificial Intelligence
Automation
2️⃣ Why Python is Easy to Learn
Python looks almost like English.
Example:
print("Hello World")
This means → display “Hello World” on the screen
No special symbols, no complicated rules.
3️⃣ Installing Python (Basic Idea)
Download Python from python.org
Install it
Use:
VS Code
IDLE
Command Prompt
(You already use VS Code 👍)
4️⃣ Your First Python Program
print(“Welcome to Python”)
Explanation:
print → built-in function
“Welcome to Python” → text (string)
Output will be:
Welcome to Python
5️⃣ Variables (Storing Data)
A variable stores a value.
name = “Rajan” age = 20
Explanation:
name→ variable name"Rajan"→ value=→ assignment operator
6️⃣ Data Types in Python
Python automatically understands data type.
| Data Type | Example |
|---|---|
| int | 10, 25 |
| float | 10.5 |
| str | “Hello” |
| bool | True / False |
Example:
price = 99.50
7️⃣ Input from User
name = input(“Enter your name: “)
print(name)
Explanation:
input() → takes data from user
Stores it in name
8️⃣ Operators
Used to perform operations.
Arithmetic Operators
a = 10
b = 5
print(a + b)
| Operator | Meaning |
|---|---|
| + | Addition |
| – | Subtraction |
| * | Multiplication |
| / | Division |
9️⃣ Conditional Statements (Decision Making)
Python checks conditions using if / else.
age = 18
if age >= 18:
print("Eligible to vote")
else:
print("Not eligible")
Explanation:
ifchecks conditionelseruns when condition is false
🔟 Loops (Repeat Work)
For Loop
for i in range(1, 6):
print(i)
Output:
1
2
3
4
5
While Loop
i = 1
while i <= 5:
print(i)
i += 1
Functions
A function is a block of reusable code.
def greet():
print("Hello Python")
greet()
Python Keywords
hese are reserved words — cannot be used as variable names.
Some important ones:
if, else, for, while, break, continue,
True, False, None,
def, return, class, import
Summary
Python is simple
✔ Easy to understand
✔ Powerful language
✔ Best for beginners