0% found this document useful (0 votes)
26 views6 pages

Class X Practical File 2025-26

The document contains a series of Python programming exercises for Class X AI, covering basic operations such as arithmetic calculations, area calculations, number classification, and loops. It includes examples for calculating simple interest, determining even/odd numbers, generating number series, and using libraries like NumPy and Matplotlib for data manipulation and visualization. Each exercise is accompanied by sample input and output to illustrate the expected results.

Uploaded by

kulshresthpulkit
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)
26 views6 pages

Class X Practical File 2025-26

The document contains a series of Python programming exercises for Class X AI, covering basic operations such as arithmetic calculations, area calculations, number classification, and loops. It includes examples for calculating simple interest, determining even/odd numbers, generating number series, and using libraries like NumPy and Matplotlib for data manipulation and visualization. Each exercise is accompanied by sample input and output to illustrate the expected results.

Uploaded by

kulshresthpulkit
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/ 6

PYTHON PRACTICAL FILE 2025-26 ClASS X AI

Q1. Write a python program to input two numbers and print their sum,
difference, product and quotient.
num1 = int(input("Enter first number: "))
num2 = int(input("Enter second number: "))
print("The sum of numbers is :" , num1 + num2)
print("The difference of numbers is :" , num1 - num2)
print("The product of numbers is :" , num1 * num2)
print("The division of numbers is :" , num1 / num2)
print("Thank you")

Enter first number: 20


Enter second number: 15

The sum of numbers is : 35


The difference of numbers is : 5
The product of numbers is : 300
The division of numbers is : 1.3333333333333333
Thank you

Q2. Write a python program to calculate area of a rectangle after taking lenght
and breadth as input from the user.
length = float(input("Enter length of the rectangle:"))
breadth = float(input("Enter breadth of the rectangle:"))
area = 2 * (length + breadth)
print("The length of the rectangle is:", length, "cms")
print("The breadth of the rectangle is:", breadth, "cms")
print("The area of the rectangle is: ", area, "cm sq.")

Enter length of the rectangle: 44


Enter breadth of the rectangle: 31

The length of the rectangle is: 44.0 cms


The breadth of the rectangle is: 31.0 cms
The area of the rectangle is: 150.0 cm sq.

Q3. Write a python program to determine whether a given number is positive,


negative or zero.
number = int(input("Enter a number:"))
if number > 0 :
print("The number you entered is positive.")
elif number <0 :
print("The number you entered is negative.")
else:
print("The number is neither positive nor negative, it is zero")

Enter a number: 55

The number you entered is positive.


Q4. Write python program to calculate simple interest after taking principal
amount(p), interest rate (r) amd time in years (y) from the user.
p = float(input("Enter principle amount:"))
r = float(input("Enter rate of interest:"))
t = float(input("Enter time:"))
simple_interest = (p * r * t) / 100
print("The simple interest is:", simple_interest)

Enter principle amount: 10000


Enter rate of interest: 5.6
Enter time: 2

The simple interest is: 1120.0

Q5. Write a python program to determine whether the given number is even or
odd.
number = int(input("Enter a number of your choice:"))
if number % 2 == 0:
print("Since the number is divisible by 2, it is even")
else:
print("Since the number is not divisible by 2, it is odd")

Enter a number of your choice: -50

Since the number is divisible by 2, it is even

Q6. Write a python program to print the table of 7 using loops.


table_of = 7
for i in range(1 , 11, 1):
print("7 x", i, "=", 7*i)

7 x 1 = 7
7 x 2 = 14
7 x 3 = 21
7 x 4 = 28
7 x 5 = 35
7 x 6 = 42
7 x 7 = 49
7 x 8 = 56
7 x 9 = 63
7 x 10 = 70

Q7. Write a python program to print the first n natural numbers. n will be
given by the user.
n = int(input("Enter a positive number upto which you want to count: "))
print("The first", n, "natural numbers are:", end= " ")
for i in range( 1 , n+1, 1):
print(i, end = " ")

Enter a positive number upto which you want to count: 16

The first 16 natural numbers are: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16


Q8. Write a python program to print the first 20 even numbers.
print("First 20 even numbers are:", end = " ")
even = 2
for i in range(20):
print(even, end = " ")
even += 2

First 20 even numbers are: 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36


38 40

Q9. Write a python program to print first n odd numbers. n will be given by
user.
n = int(input("Enter the number of odd numbers you want to print:"))
odd = 1
print("First n odd numbers are:", end = " ")
for i in range(n):
print(odd, end= " ")
odd += 2

Enter the number of odd numbers you want to print: 10

First n odd numbers are: 1 3 5 7 9 11 13 15 17 19

Q10. Write a python program to print the names of friends from a list.
friends = ["Neha", "Arti", "Soham", "Sakshi", "Rudra", "Radhika", "Yasmeen"]
for names in friends:
print(names)

Neha
Arti
Soham
Sakshi
Rudra
Radhika
Yasmeen

Q11. Write the python program to combine the lists given below into a list
named Class10
boys = ["Rakshit", "Daksh", "Abhay"]
girls = ["Riya", "Pratha", "Ashna"]
boys = ["Rakshit", "Daksh", "Abhay"]
girls = ["Riya", "Pratha", "Ashna"]
class10 = boys + girls
print("Boys + girls of class X are:", class10)

Boys + girls of class X are: ['Rakshit', 'Daksh', 'Abhay', 'Riya', 'Pratha',


'Ashna']
Q12. Write a python program to print the following series-
1, 4, 7, 10, . . . . . . 40
start = 1
end = 40
diff = 3
for i in range(start, end + 1, diff):
print(i, end= " ")

1 , 4 , 7 , 10 , 13 , 16 , 19 , 22 , 25 , 28 , 31 , 34 , 37 , 40 ,

Q12. Using numpy in python, create an array of numbers from 1 to 20


import numpy as np
array = np.arange(1, 21, 1)
print("Numpy array of 1 to 20:", array)

Numpy array of 1 to 20: [ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18


19 20]

Q13. Consider the numpy array-


import numpy as np
narr = np.array([23, 24, 66, 70, 40, 24])
Write code to print the mean(avaerage) of the numpy array.
import numpy as np
narr = np.array([23, 24, 66, 70, 40, 24])
print("The array is:", narr)
print("The average/mean of the array is:", np.mean(narr))

The array is: [23 24 66 70 40 24]


The average/mean of the array is: 41.166666666666664

Q14. Write python code to print the line chart for sales in 4 quarters.
Quarters = ["Q1", "Q2", "Q3", "Q4"]
Sales = [ 24000, 30000, 34000, 33000]
import matplotlib.pyplot as plt
quarters = ["Q1", "Q2", "Q3", "Q4"]
sales = [24000, 30000, 34000, 33000]
plt.plot(quarters, sales , color = "Red")
plt.show()
Q15. Consider the 2 lists- Section and contribution.
Create a bar graph with section on x-axis and contribution on y-axis.
section = ["A", "B", "C", "D"]
contribution = [2000, 2300, 1900, 2100]
import matplotlib.pyplot as plt
section = ["A", "B", "C","D"]
contribution = [2000, 2300, 1900, 2100]
plt.bar(section, contribution)
plt.show()

You might also like