0% found this document useful (0 votes)
14 views8 pages

Class IX AI Winter Homework Guide

The document contains a series of Python programming exercises designed for Class IX students focusing on artificial intelligence. Each exercise includes a problem statement, sample code, and expected output, covering topics such as personal information input, calculations for simple interest, area and perimeter of shapes, and basic conditional statements. The exercises aim to enhance practical programming skills and understanding of fundamental concepts in Python.

Uploaded by

dharyapandey7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views8 pages

Class IX AI Winter Homework Guide

The document contains a series of Python programming exercises designed for Class IX students focusing on artificial intelligence. Each exercise includes a problem statement, sample code, and expected output, covering topics such as personal information input, calculations for simple interest, area and perimeter of shapes, and basic conditional statements. The exercises aim to enhance practical programming skills and understanding of fundamental concepts in Python.

Uploaded by

dharyapandey7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CLASS IX ARTIFICIAL INTELLIGENCE

WINTER BREAK HOMEWORK

Make Your AI Practical File

PRACTICAL FILE PROGRAMS


1. Write a program to print personal information.
a = input (“ Enter your name:”)
b = input (“ Enter your father’s name:”)
c = input (“ Enter your class:”)
d = input (“ Enter your school name:”)
print(a)
print(b)
print(c)
print(d)
Output:
Enter your name: RAVI
Enter your father’s name: RAM
Enter your class: 09
Enter your school name: KV No1 School
RAVI
RAM
09
KV No1 School
2. Calculate simple interest for principal amount = 2000, rate of interest
4.5% and time 10 years.
pa = 2000
roi = 4.5
t = 10
si = (pa * roi * t)/100
print(“Simple interest =”, si)
Output:
Simple interest = 900.0

3. Calculate area and perimeter of rectangle.


l = int(input (“ Enter length of rectangle”))
b = int(input(“ Enter breadth of rectangle”))
a=l*b
p = 2 * ( l+b )
print(“The area of rectangle =”,a)
print(“ The perimeter of rectangle =”,b)
Output:
Enter length of rectangle: 5
Enter breadth of rectangle: 3
The area of rectangle = 15
The perimeter of rectangle = 16
4. Convert given length in km to meters.
a = int (input ( “Enter length in kilometers”))
b = a * 1000
print( “Length in meters = “,b)
Output:
Enter length in kilometers: 5
Length in meters = 5000

5. Calculate area and permeter of a rectangle


# Input: Length and width of the rectangle
length = float(input("Enter the length of the rectangle: "))
width = float(input("Enter the width of the rectangle: "))
# Calculate area and perimeter
area = length * width
perimeter = 2 * (length + width)
# Output: Display the results
print(f"The area of the rectangle is: {area}")
print(f"The perimeter of the rectangle is: {perimeter}")
Output:
Enter the length of the rectangle: 7
Enter the width of the rectangle: 4
The area of the rectangle is: 28.0
The perimeter of the rectangle is: 22.0
6. Write a Program in Python to calculate the area of a triangle using its base
and height
# Input: Base and height of the triangle
base = float(input("Enter the base of the triangle: "))
height = float(input("Enter the height of the triangle: "))
# Calculate area
area = 0.5 * base * height
# Output: Display the result
print(f"The area of the triangle is: {area}")
OUTPUT:
Enter the base of the triangle: 10
Enter the height of the triangle: 5
The area of the triangle is: 25.0

7. Calculate average marks of 3 subjects.


a = int(input(“Enter first number”))
b = int(input(“Enter second number”))
c = int(input(“Enter third number”))
avg = (a+b+c)/3
print(“ The average of three numbers =”, avg)
OUTPUT:
Enter first number: 10
Enter second number: 20
Enter third number: 30
The average of three numbers = 20.0
8. Write a Python program to calculate the discounted amount given the
original price and discount percentage
# Input: Original price and discount percentage
Original_price = float(input("Enter the original price: "))
discount_percentage = float(input("Enter the discount percentage: "))
# Calculate discount amount and final price
discount_amount = (discount_percentage / 100) * original_price
final_price = original_price - discount_amount
# Output: Display the results
print(discount_amount)
print(final_price)
OUTPUT:
Enter the original price: 1000
Enter the discount percentage: 20
Discount amount = 200.0
Final price = 800.0

9. write a python program to calculate surface area and volume of a cuboid


# Input: Length, width, and height of the cuboid
length = float(input("Enter the length of the cuboid: "))
width = float(input("Enter the width of the cuboid: "))
height = float(input("Enter the height of the cuboid: "))
# Calculate the surface area
surface_area = 2 * (length * width + width * height + height * length)
# Calculate the volume
volume = length * width * height
# Output: Display the results
print(surface_area)
print(volume)
OUTPUT:
Enter the length of the cuboid: 4
Enter the width of the cuboid: 3
Enter the height of the cuboid: 2
Surface area of the cuboid = 52.0
Volume of the cuboid = 24.0

10 Write a program in python to find the square of number 7


a= 7
b=a*a
print (“ The square of number 7 is “ , b)
OUTPUT:
The square of number 7 is 49

11. Write a Program in Python find the sum of two numbers 15 and 20
a = 15
b = 20
c=a+b
printf(“ The Sum of 15 and 20 is”, c)
OUTPUT:
The Sum of 15 and 20 is 35
12. Write a Python Program to convert length given in Kilometers into
Metres.
# Input: Length in kilometers
kilometers = float(input("Enter the length in kilometers: "))
# Conversion factor
meters = kilometers * 1000
# Output: Display the result
print(meters)
OUTPUT:
Enter the length in kilometers: 5
5000.0

13 write a python program to print the table of 5 upto 5 term


# Table of 5 up to 5 terms
print("5 x 1 =", 5 * 1)
print("5 x 2 =", 5 * 2)
print("5 x 3 =", 5 * 3)
print("5 x 4 =", 5 * 4)
print("5 x 5 =", 5 * 5)
OUTPUT:
5x1=5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
14 Program to check if a person can vote .
age = int(input(“Enter your age”))
if age>= 18:
print(“You are eligible to vote”)
else:
print(“You are not eligible to vote”)
OUTPUT:
Enter your age: 20
You are eligible to vote

15. Program to check if a number is positive or negative.


num = float(input(“Enter a number”))
if num >= 0:
if num == 0:
print(“Zero”)
else:
print(“Positive number”)
else:
print(“Negative number”)
OUTPUT:
Enter a number: 5
Positive number

You might also like