What is Python?
Python is a simple and easy programming language used to give instructions to a computer.
It is widely used in Artificial Intelligence, games, websites, and data analysis.
Basic Features of Python
Easy to read and write
Uses simple English words
Case-sensitive (A ≠ a)
No need to declare data types
Basic Concepts
Variables – store values
Example: a = 10
Data Types – int, float, string
Example: 10, 3.5, "Hello"
Operators – + - * /
Basic Python Functions (Class 6 Level)
Function Use
print() Displays Output
input() Takes input from user
type() Shows data type
len() Finds length
int() Converts to integer
float() Converts to decimal
str() Converts to string
Conditional Statements
Conditional statements are used to make decisions in a program. They tell the
computer what to do when a condition is true or false.
Example: If it rains, take an umbrella.
Types of Conditional Statements
1. if statement: The if statement runs a block of code only when the condition is true.
2. if–else statement: The else part runs when the if condition is false.
3. if–elif–else statement: Used when there are multiple conditions.
Comparison Operators: Used to compare values
Operator Meaning
== Equal to
!= Not equal
> Greater than
< Less than
>= Greater than or equal
<= Less than or equal
Logical Operators: Used to check more than one condition
Operator Meaning
and Both conditions are true
or Any one condition true
not Reverse the result
Looping: Looping means repeating a task again and again until a condition is met.
Example: Brushing teeth every day – same action, repeated.
Types of Loops in Python
1. for loop: used when we know how many times the loop will run.
Known number of times
Uses range()
Simple and short
2. while loop: used when we do not know how many times the loop will run.
Unknown number of times
Uses condition
Needs more care