0% found this document useful (0 votes)
6 views16 pages

Practical File Class X 2024-25

The document is a practical file for Class X students at Titiksha Public School, focusing on Artificial Intelligence. It includes a series of programming tasks with objectives, source code, and expected outputs, covering topics such as basic arithmetic, interest calculations, geometric calculations, and data visualization using Matplotlib and Numpy. The file is submitted by Shresth Mishra and includes an index of the programs listed.

Uploaded by

Babita Pathak
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)
6 views16 pages

Practical File Class X 2024-25

The document is a practical file for Class X students at Titiksha Public School, focusing on Artificial Intelligence. It includes a series of programming tasks with objectives, source code, and expected outputs, covering topics such as basic arithmetic, interest calculations, geometric calculations, and data visualization using Matplotlib and Numpy. The file is submitted by Shresth Mishra and includes an index of the programs listed.

Uploaded by

Babita Pathak
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/ 16

Titiksha Public school

All India Secondary School Examination


Subject: Artificial Intelligence (417)
Practical File
Class: X
Session: 2024-2025
Submitted To: -Mrs. Jyoti Rathi
Submitted by:- Name:Shresth Mishra
Roll No:40
INDEX

S.No. Program Name Signature

1Write a program to print the sum of three numbers entered by the


user.
2 Write a program to calculate simple interest and Compound interest.

3 Write a program to calculate the area and circumference of a Circle.

4Write a python program to calculate the sum and average of the marks
obtained by a student in all five subjects.
5 Write a program to check whether the year is leap or not?

6Write a python program to check the divisibility of a given number with


another number.

7 Write a program to calculate surface area of cube and cuboid.

8Write a program to enter the age and check whether a person is


eligible to vote or not.

9Write a program to check whether a number is positive , negative or


zero.

10 Write a program to design five functions for a mathematical calculator.


Using Matplotlib and the given data, plot a bar chart:
No of people voted = [23,45,31,40,35]
11
Area Covered = [‘a1’, ‘a2’, ‘a3’, ‘a4’, ‘a5’]
Using Matplotlib and the given data, plot a line
chart: x_axis = [3,4,6,2,8]
12
y_axis = [9,10,8,7,6]

13Using Matplotlib and the given data, plot a pie chart:


Data = [45,23,41,78,65]
Using Matplotlib and the given data, plot a scatter chart:
14 15 39]
Using Numpy Package:
● Create a 4X2 array with
Height = [4.5, 5.2, 4.1, 3.5, random integer ● Create a
5] 3X3 array with all zeros
Weight = [34, 41, 45, 56,
Program No: 1

Program Name: Write a program to print the sum of three numbers entered by the user.

Learning Objective: To understand how to take input numbers from user and print their sum

Source Code:

a= int(input(“Enter 1st Number: ”))

b= int(input(“Enter 2nd Number: ”))

c= int(input(“Enter 3rd Number: ”))

Sum = a+b+c

print (“Sum of the three numbers is: ”, Sum)

Output:

Program No: 2

Program Name: Write a program to calculate simple interest and Compound interest.

Learning Objective: To understand the concept of simple Interest and compound interest

Source Code:

principal=int(input("Enter principal="))

rate=float(input("Enter rate="))

time=int(input("Enter time="))

si=principal*rate*time/100

print("The simple interest is",si)

ci=principal*(1+rate/100)**time
print("The compound Interest is",ci)

Output:

Program No: 3

Program Name: Write a program to calculate the area and circumference of a Circle.

Learning Objective: To understand the concept of area and circumference of a circle.

Source Code:

r= int(input(“Enter the radius of your circle”))

c= 2*3.14*r

a= 3.14*r**2

print (“The circumference of your circle is: ”, c)

print (“The area of your circle is: ”, a)

Output:

Program No: 4

Program Name: Write a python program to calculate the sum and average of the marks
obtained by a student in all five subjects.

Learning Objective: To understand the concept of average and addition.

Source Code:
a= float(input(“Enter marks in English: ”))

b= float(input(“Enter marks in Hindi: ”))

c= float(input(“Enter marks in Science: ”))

d= float(input(“Enter marks in SSC: ”))

e= float(input(“Enter marks in Maths: ”))

sum= a+b+c+d+e

avg= sum/5

print= (“Sum of your marks = ”, sum)

print= (“Average of your marks = ”, avg)

Output:

Program No: 5

Program Name: Write a program to check whether the year is leap or not?

Learning Objective: To understand the concept of leap years.

Source Code:

a= int(input(“Enter any year of your choice: ”))

If a%4==0 :

print(“Your given year is a leap year.”)


else:

print(“The given year is not a leap year.”)

Output:

Program No: 6

Program Name: Write a python program to check the divisibility of a given number with
another number.

Learning Objective: To understand the concept of divisibility.

Source Code:

a= int(input(“Enter 1st number of your choice: ”))

b= int(input(“Enter 2nd number of your choice: ”))

If a%b==0 :

print(“1st number is divisible by 2nd number.”)

else:

print(“1st number is not divisible by 2nd number.”)

Output:
Program No: 7

Program Name: Write a program to calculate surface area of cube and cuboid.

Learning Objective: To understand the concept of surface area.

Source Code:

choice= int(input(“Enter 1 for cube and 2 for cuboid: \n”))

if choice==1 :

a= float(input(“Enter the side length of the cube: ”))

s1= 6*a**2

print(“Surface area of the cube = ”, s1, “units”)

elif choice==2 :

len= float(input(“Enter the length of the cuboid: ”))

w= float(input(“Enter the width of the cuboid: ”))

h= float(input(“Enter the height of the cuboid: ”))

s2= (2*len*w) + (2*w*h) + (2*len*h)

print(“Surface area of the cuboid = ”, s2, “units”)

else :

print(“Invalid choice.”)

Output:
Program No: 8

Program Name: Write a program to enter the age and check whether a person is eligible to vote
or not.

Learning Objective: To understand the concept of voting age.

Source Code:

a= int(input(“Enter your age: \n”))

If a>=18 :

print(“You are eligible to vote!”)

else:

print(“You are not eligible to vote!”)

Output:
Program No: 9

Program Name: Write a program to check whether a number is positive , negative or zero.

Learning Objective: To understand the concept of positive, negative and zero as a number.

Source Code:

a= int(input(“Enter any number: ”))

If a>0 :

print(“This is a positive number!”)

elif a<0 :

print(“This a negative number.”)

else:

print(“Your number is zero.”)

Output:
Program No: 10

Program Name: Write a program to design five functions for a mathematical calculator.

Learning Objective: To understand the concept of a calculator and its operations.

Source Code:

print(“Calculator\n------------------------”)

a= float(input(”Enter any number : ”))

b= float(input(“Enter any other number : ”))

x= int(input(“Choose from the following:\n 1 for Addition\n 2 for Subtraction\n 3 for


Multiplication\n 4 for Division\n 5 for Exponential solving\n”))

If x==1 :

print(“Sum is ”, a+b)

elif x==2 :

print(“Difference is ”, a-b)

elif x==3 :

print(“Product is ”, a*b)

elif x==4 :

print(“Quotient is ”, a/b)
elif x==5 :

print(“Exponent is ”, a**b)

else

print(“Invalid option”)

Output:
Program No: 11

Program Name: Using Matplotlib and the given data, plot a bar chart:

No of people voted = [23,45,31,40,35]


Area Covered = [‘a1’, ‘a2’, ‘a3’, ‘a4’, ‘a5’]

Learning Objective: To understand the way to plot a bar

chart. Source Code:

import matplotlib.pyplot as plt

No_of_people_voted = [23,45,31,40,35]

plt.bar([‘a1’, ‘a2’, ‘a3’, ‘a4’, ‘a5’], No_of_people_voted)

plt.title(‘Bar Chart’)

plt.xlabel(‘Area Covered’)

plt.ylabel(‘No of people voted’)

plt.show()

Output:
Program No: 12

Program Name: Using Matplotlib and the given data, plot a line chart:

x_axis = [3,4,6,2,8]
y_axis = [9,10,8,7,6]

Learning Objective: To understand the way to plot a line

chart. Source Code:

import matplotlib.pyplot as plt

import numpy as np

x= np.array([3,4,6,2,8])

y= np.array([9,10,8,7,6])
plt.title(‘Line Chart’)

plt.plot(x, y)

plt.show()

Output:
Program No: 13

Program Name: Using Matplotlib and the given data, plot a pie chart:

Data = [45,23,41,78,65]

Learning Objective: To understand the way to plot a pie chart.

Source Code:

from matplotlib import pyplot as plt

import numpy as np

fig= plt.figure()

ax= fig.add_axes([0,0,1,1])

ax.axis(‘equal’)

Data= [45,23,41,78,65]

ax.pie(Data, autopct=’%1.2f%%’)

plt.show()

Output:
Program No: 14

Program Name: Using Matplotlib and the given data, plot a scatter chart:

Height = [4.5, 5.2, 4.1, 3.5, 5]


Weight = [34, 41, 45, 56, 39]

Learning Objective: To understand the way to draw a scatter plot.


Source Code:

import matplotlib.pyplot as plt

weight= [34,41,45,56,39]

height= [4.5,5.2,4.1,3.5,5]

plt.scatter(height, weight, c=’blue’)

plt.title(‘Scatter plot’)

plt.xlabel(‘Height’)

plt.ylabel(‘Weight’)

plt.show()

Output:
Program No: 15

Program Name: Using Numpy Package:

● Create a 4X2 array with random integer


● Create a 3X3 array with all zeros

Learning Objective: To understand the concept of

arrays. Source Code:

● Create a 4X2 array with random integer

import numpy as np

array1= np.random.randint(0,10, (4,2))

print(“4X2 Array with Random Integers :

\n”) print(array1)

● Create a 3X3 array with all zeros


import numpy as np

array2= np.zeros((3,3))

print(“\n 3X3 Array with Zeros: \n”)

print(array2)

Output:

You might also like