UNIT 04-Introduction to Python
UNIT 04-Introduction to Python
Class IX
Subject - Artificial Intelligence
UNIT 4: Introduction To Python
1. What is Python?
● Python is a high-level, interpreted programming language known for its simplicity and readability.
● It is widely used for web development, data analysis, artificial intelligence, and more.
2. Features of Python
● Easy to Learn and Use: Python's syntax is simple and close to human language.
● Interpreted Language: Code is executed line by line, which makes debugging easier.
● Cross-Platform: Python works on various operating systems like Windows, macOS, and Linux.
● Open Source: Python is free to use and distribute, including for commercial purposes.
sum = 5 + 3 # Addition
product = 5 * 3 # Multiplication
is_equal = (5 == 5) # Comparison (True or False)
4. Control Structures
● Conditional Statements: Used to make decisions.
for i in range(5):
print(i)
● While Loop: Continues until a condition is met.
count = 0
while count < 5:
print(count)
count += 1
7. Basic Programs
1. Hello, World
print("Hello, World!")
2. Simple Calculator
num1 = int(input("Enter first number: "))
num2 = int(input("Enter second number: "))
sum = num1 + num2
print("Sum:", sum)
Program List
PRINT • To print personal information like Name, Father’s Name, Class, School Name
• To find square of number 7
• To find the sum of two numbers 15 and 20
• To convert length given in kilometers into meters
• To print the table of 5 up to five terms
• To calculate Simple Interest if the principle_amount = 2000, rate_of_interest =
4.5, time = 10