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

GRADE X AI - PRCATICAL PROGRAMS - Term 1

The document outlines practical assignments for a Class X Artificial Intelligence course, focusing on Python programming tasks. It includes programs for checking voting eligibility, determining student grades, assessing number positivity, finding the greatest among three numbers, and plotting various graphs using matplotlib. Each task is accompanied by sample code and expected output.

Uploaded by

funpotato4
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)
65 views8 pages

GRADE X AI - PRCATICAL PROGRAMS - Term 1

The document outlines practical assignments for a Class X Artificial Intelligence course, focusing on Python programming tasks. It includes programs for checking voting eligibility, determining student grades, assessing number positivity, finding the greatest among three numbers, and plotting various graphs using matplotlib. Each task is accompanied by sample code and expected output.

Uploaded by

funpotato4
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/ 8

SESSION 2025-2026

ARTIFICIAL INTELLIGENCE (SUB. CODE 417) – PRCATICALS


CLASS – X
PART-C: PRACTICAL WORK FOR TERM 1

1 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:
2 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:
3 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:
4 Write a python program to Find the Greatest Among Three Numbers.

Program:

num1 = float(input("Enter first number: "))


num2 = float(input("Enter second number: "))
num3 = float(input("Enter third number: "))

# Compare the numbers


if num1 >= num2 and num1 >= num3:
greatest = num1
elif num2 >= num1 and num2 >= num3:
greatest = num2
else:
greatest = num3

# Output the greatest number


print("The greatest number is:", greatest)

Output:
5 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:
6 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:
7 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:
8 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