Python Coding Notes - Class 9 (Basic Level)
1. Print Statement
Syntax:
print("Your text")
Example:
print("Hello, World!")
Output:
Hello, World!
2. Variables
Variables store data.
Example:
name = "Supriya"
age = 14
print(name)
print(age)
3. If-Else Statement
Used to check conditions.
Example:
marks = 70
if marks >= 33:
print("Pass")
else:
print("Fail")
4. For Loop
Used to repeat code.
Example:
for i in range(1, 11):
Python Coding Notes - Class 9 (Basic Level)
print(i)
5. While Loop
Example:
i=1
while i <= 5:
print(i)
i += 1
6. Even Numbers from 1 to 100
Example:
for i in range(1, 101):
if i % 2 == 0:
print(i)
7. Input from User
Used to take user input.
Example:
name = input("Enter your name: ")
print("Hello", name)
Tips for Exam
- Practice basic programs daily
- Understand print, input, if-else, and loops
- Write and run programs on a computer if possible
- Don't panic, just focus on logic step by step