0% found this document useful (0 votes)
21 views17 pages

GRADE X AI - PRCATICAL PROGRAMS

The document outlines the practical work requirements for the Artificial Intelligence subject for Class X, including a total of 50 marks divided into practical work, coursework, and viva voce. It provides a list of 25 Python programming tasks, ranging from basic input/output operations to graphical plotting using matplotlib. Each task includes a brief description, the required program, and expected output.

Uploaded by

Muhammed Rehan
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)
21 views17 pages

GRADE X AI - PRCATICAL PROGRAMS

The document outlines the practical work requirements for the Artificial Intelligence subject for Class X, including a total of 50 marks divided into practical work, coursework, and viva voce. It provides a list of 25 Python programming tasks, ranging from basic input/output operations to graphical plotting using matplotlib. Each task includes a brief description, the required program, and expected output.

Uploaded by

Muhammed Rehan
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
You are on page 1/ 17

SESSION 2024-2025 – PRCATICALS

ARTIFICIAL INTELLIGENCE (SUB. CODE 417)


CLASS – X
PART C Practical Work: Marks
Practical File with minimum 15 15
Programs
Practical Examination
• Unit 3: Advance Python 5
• Unit 4: Data Science 5
• Unit 5: Computer Vision 5
Viva Voce 5
Total 35
PART D Course work (mandatory)- please 10
complete and submit the certificate.

Field Work (optional)- if done submit


your certificates

Viva Voce (based on the course work) 5


Total 15
GRAND TOTAL 50

PART-C: PRACTICAL WORK


1 Write a Python program to print personal information like Name, Father’s
Name, Class, School Name.
Program:

name = input("Enter your Name:")


fathers_name = input("Your Father's Name:")
class_name = input("Your Class:")
school_name = input("Your School Name:")

# Display personal information


print("Personal Information:")
print("Name:", name)
print("Father's Name:", fathers_name)
print("Class:", class_name)
print("School Name:", school_name)
Output:

2 Write a Python program to print the following patterns using multiple


print commands.

Program:

print("* **** *")


print("* * *** *")
print("* ** ** *")
print("* *** * *")
print("* **** *")

Output:
3 Write a Python program to find square of number 7.
Program:

number = 7
square = number ** 2

print("The square of", number, "is:", square)

Output:

OR

Program:

number = 7
square = pow(number, 2)

print("The square of", number, "is:", square)

Output:

4 Write a Python program to find the sum of two numbers 15 and 20.
Program:

num1 = 15
num2 = 20
sum = num1 + num2
print("The sum of", num1, "and", num2, "is:", sum)

Output:
5 Write a Python program to convert length given in kilometers into meters.
Program:

# Input: length in kilometers


kilometers = float(input("Enter length in kilometers: "))

# Conversion factor
meters = kilometers * 1000

# Display result
print(kilometers, "kilometers is equal to", meters, "meters.")

Output:

6 Write a Python program to print the table of 5 up to five terms.


Program:

number = 5

# Loop to print the table up to 5 terms


for i in range(1, 6):
result = number * i
print(number, "x", i, "=", result)

Output:
7 Write a Python program to calculate Simple Interest if the
principle_amount = 2000, rate_of_interest = 4.5 and time = 10.
Program:

principal_amount = 2000
rate_of_interest = 4.5
time = 10

# Calculate Simple Interest


simple_interest = (principal_amount * rate_of_interest * time) / 100

# Display the result


print("The Simple Interest is:", simple_interest)

Output:

8 Write a Python program to calculate Area and Perimeter of a rectangle.


Program:

length = float(input("Enter the length of the rectangle: "))


width = float(input("Enter the width of the rectangle: "))

# Calculate Area
area = length * width
# Calculate Perimeter
perimeter = 2 * (length + width)

# Display the results


print("The Area of the rectangle is:", area)
print("The Perimeter of the rectangle is:", perimeter)

Output:
9 Write a Python program to calculate Area of a triangle with Base and
Height.
Program:

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

# Display the result


print("The Area of the triangle is:", area)

Output:

10 Write a Python program to calculate average marks of 3 subjects.


Program:

subject1 = float(input("Enter marks for Subject 1: "))


subject2 = float(input("Enter marks for Subject 2: "))
subject3 = float(input("Enter marks for Subject 3: "))

# Calculate average
average_marks = (subject1 + subject2 + subject3) / 3

# Display the result


print("The average marks are:", average_marks)

Output:
11 Write a Python program to calculate discounted amount with discount %.
Program:

# 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


discount_amount = (discount_percentage / 100) * original_price

# Calculate discounted price


discounted_price = original_price - discount_amount

# Display the results


print("The discount amount is:", discount_amount)
print("The discounted price is:", discounted_price)

Output:

12 Write a Python program to calculate Surface Area and Volume of a Cuboid.


Program:

# Input: dimensions 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 Surface Area


surface_area = 2 * (length * width + width * height + height * length)

# Calculate Volume
volume = length * width * height

# Display the results


print("The Surface Area of the cuboid is:", surface_area)
print("The Volume of the cuboid is:", volume)
Output:

13 Write a Python program to check if a person is eligible to vote or not.


Program:

# Get the user's age


age = int(input("Enter your age: "))

# Check eligibility
if age >= 18:
print("You are eligible to vote.")
else:
print("You are not eligible to vote.")

Output:

14 Write a Python program to check the grade of a student.


Program:

score = float(input("Enter the student's score (0-100): "))

# Determine the grade


if score >= 90:
grade = 'A'
elif score >= 80:
grade = 'B'
elif score >= 70:
grade = 'C'
elif score >= 60:
grade = 'D'
else:
grade = 'F'

# Print the grade


print("The student's grade is:", grade)

Output:

15 Write a Python program to Input a number and check if the number is


positive, negative or zero and display an appropriate message.
Program:

# Get the number from the user


number = float(input("Enter a number: "))

# Check if the number is positive, negative, or zero


if number > 0:
print("The number is positive.")
elif number < 0:
print("The number is negative.")
else:
print("The number is zero.")

Output:

16 Write a Python program to print first 10 natural numbers.


Program:

# Print the first 10 natural numbers


for i in range(1, 11):
print(i)
Output:

17 Write a Python program to print the first 10 even numbers.


Program:

# Print the first 10 even numbers


for i in range(2, 21, 2):
print(i)

Output:
18 Write a Python program to print odd numbers from 1 to n.
Program:

# Get the value of n from the user


n = int(input("Enter a number (n): "))

# Print odd numbers from 1 to n


print("Odd numbers from 1 to", n, "are:")
for i in range(1, n + 1):
if i % 2 != 0:
print(i)

Output:

19 Write a Python program to print the sum of the first 10 natural numbers.
Program:

# Initialize the sum


sum_natural_numbers = 0
# Calculate the sum of the first 10 natural numbers
for i in range(1, 11):
sum_natural_numbers += i

# Print the sum


print("The sum of the first 10 natural numbers is:", sum_natural_numbers)

Output:
20 Write a Python program to print factorial of a number.
Program:

number = int(input("Enter a number: "))

# Initialize factorial to 1
factorial = 1

# Calculate factorial
if number < 0:
print("Factorial is not defined for negative numbers.")
elif number == 0:
print("The factorial of 0 is 1.")
else:
for i in range(1, number + 1):
factorial *= i
print("The factorial of", number, "is:", factorial)

Output:

21 Write a python menu driven program to find the area of different


geometrical shapes.
Program:

while True:
print("\nMenu:")
print("1. Area of Circle")
print("2. Area of Rectangle")
print("3. Area of Triangle")
print("4. Area of Square")
print("5. Exit")

choice = input("Enter your choice (1-5): ")

if choice == '1':
radius = float(input("Enter the radius of the circle: "))
area = 3.14 * radius ** 2
print("Area of the circle:", area)
elif choice == '2':
length = float(input("Enter the length of the rectangle: "))
width = float(input("Enter the width of the rectangle: "))
area = length * width
print("Area of the rectangle:", area)
elif choice == '3':
base = float(input("Enter the base of the triangle: "))
height = float(input("Enter the height of the triangle: "))
area = 0.5 * base * height
print("Area of the triangle:", area)
elif choice == '4':
side = float(input("Enter the side of the square: "))
area = side ** 2
print("Area of the square:", area)
elif choice == '5':
print("Exiting the program.")
break
else:
print("Invalid choice. Please enter a number between 1 and 5.")

Output:
22 Write a python program to plot a bar graph using the data given below:

Categories: Category A, Category B, Category C, Category D


Values: 10, 15, 7, 12
Program:

import matplotlib.pyplot as plt

# Sample data
categories = ['Category A', 'Category B', 'Category C', 'Category D']
values = [10, 15, 7, 12]

# Create a bar graph


plt.bar(categories, values, color='skyblue')

# Adding title and labels


plt.title('Bar Graph - Categories Vs Values')
plt.xlabel('Categories')
plt.ylabel('Values')

# Show the plot


plt.show()

Output:
23 Write a python program to plot a line graph using the data given below:

Exams: Exam 1, Exam 2, Exam 3, Exam 4, Exam 5


Marks: 85, 90, 78, 92, 88
Program:

import matplotlib.pyplot as plt

# Sample data for student marks in different exams


exams = ['PT1', 'Term 1', 'PT2', 'Model', 'Board']
marks = [85, 90, 78, 92, 88]

# Create a line graph for student marks


plt.plot(exams, marks, color='green')

# Adding title and labels


plt.title('Student Marks in Different Exams')
plt.xlabel('Exams')
plt.ylabel('Marks')

# Display the plot


plt.show()

Output:
24 Write a python program to Plot a line chart using the given temperature
data.

Program:

import matplotlib.pyplot as plt

# Monthly temperature data


months = ['January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December']
temperatures = [5, 7, 12, 18, 23, 28, 30, 29, 24, 18, 10, 6]

# Plotting the line chart


plt.plot(months, temperatures, marker='o', color='blue', linestyle='-')

# Adding title and labels


plt.title('Monthly Temperature Readings')
plt.xlabel('Month')
plt.ylabel('Temperature (°C)')

# Show the plot


plt.show()

Output:
25 Write a python program to Plot a bar graph using the given data.

Program:

import matplotlib.pyplot as plt


# Product sales data
products = ['Product A', 'Product B', 'Product C', 'Product D', 'Product E']
sales = [150, 300, 200, 100, 250]

# Plotting the bar graph


plt.bar(products, sales, color='purple')

# Adding title and labels


plt.title('Sales Data for Different Products')
plt.xlabel('Product')
plt.ylabel('Sales (units)')

# Show the plot


plt.show()

Output:

You might also like