Practical file class X 2024-25[1] - for merge
Practical file class X 2024-25[1] - for merge
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 = a+b+c
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
ci=principal*(1+rate/100)**time
Output:
Program No: 3
c= 2*3.14*r
a= 3.14*r**2
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.
Source Code:
sum= a+b+c+d+e
avg= sum/5
Output:
Program No: 5
Program Name: Write a program to check whether the year is leap or not?
Source Code:
If a%4==0 :
else:
Output:
Program No: 6
Program Name: Write a python program to check the divisibility of a given number with
another number.
Source Code:
If a%b==0 :
else:
Output:
Program No: 7
Program Name: Write a program to calculate surface area of cube and cuboid.
Source Code:
if choice==1 :
s1= 6*a**2
elif choice==2 :
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.
Source Code:
If a>=18 :
else:
Output:
Program No: 9
zero. Learning Objective: To understand the concept of positive, negative and zero as a
”)) If a>0 :
elif a<0 :
else:
Output:
Program No: 10
Program Name: Write a program to design five functions for a mathematical calculator.
Source Code:
print(“Calculator\n----------------------”)
If x==1 :
print(“Sum is ”,
print(“Difference is ”, a-b)
elif x==3 :
print(“Product is ”,
print(“Quotient is ”,
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:
Source Code:
No_of_people_voted = [23,45,31,40,35]
plt.title(‘Bar Chart’)
plt.xlabel(‘Area Covered’)
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]
Source Code:
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]
Source Code:
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:
Source Code:
weight= [34,41,45,56,39]
height= [4.5,5.2,4.1,3.5,5]
plt.title(‘Scatter plot’)
plt.xlabel(‘Height’)
plt.ylabel(‘Weight’)
plt.show()
Output:
Program No: 15
Source Code:
import numpy as np
print(array1)
array2= np.zeros((3,3))
print(array2)
Output: