Class IX Practical File-1
Class IX Practical File-1
OF
SESSION 2022-2023
BY :
NAME: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
ROLL NO: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
UNDER GUIDANCE OF
CLASS-IX
SUBMITTED TO:
I am satisfied with his initiatives and his effort for completion of the practical work.
As a part of curriculum of CBSE class IX examination.
Mr. Vinay Mathur & Devendra Singh Chouhan Ms. Niharika Chopra
average = total / 5
OUTPUT- 1
OUTPUT- 2
inr = usd * 73
&
usd = inr/73
OUTPUT-1
OUTPUT-2
if (num % 2 != 0):
print("Number is odd")
else:
print("Number is even")
OUTPUT-1
Number is even
OUTPUT-2
Number is odd
4.# Program to display the following pattern :
b)1
12
123
print("")
OUTPUT-1
12
123
1234
12345
OUTPUT-2
12
5.# Program to check if the entered number is prime or not.
for i in range(2,int(num/2)+1):
if(num % i) == 0:
break
else:
else:
OUTPUT-1
17 is a prime number
OUTPUT-2
for i in range(1,6):
print(table,"*",i,"=",table*i)
OUTPUT-1
4*1=4
4*2=8
4 * 3 = 12
4 * 4 = 16
4 * 5 = 20
OUTPUT-2
2*1=2
2*2=4
2*3=6
2*4=8
2 * 5 = 10
7.# Program to calculate the grade of students : Marks
> = 90 A1
>=80 A2
>=70 B1
>=60 B2
>=50 C1
>=40 C2
>=33 D
<=33 E
print("A1")
print("A2")
print("B1")
print("B2")
print("C1")
print("C2")
print("D")
else:
print("E")
OUTPUT-1
A2
OUTPUT-2
E
8.# Program to calculate the factorial of a number
factorial = 1
if num == 0:
else:
factorial = factorial*i
OUTPUT-1
Enter a number: 6
The factorial of 6 is 1
The factorial of 6 is 2
The factorial of 6 is 6
The factorial of 6 is 24
OUTPUT-2
Enter a number: 4
The factorial of 4 is 1
The factorial of 4 is 2
The factorial of 4 is 6
The factorial of 4 is 24
9.# Program to calculate the discount Total amount > 10000 (20% ) >5000 (10%)
<5000 (5%)
if amount> 10000:
else:
OUTPUT-1
OUTPUT-2
a) 1 + 2 + 3 + ………..
b) 2 + 4 + 6 + ……..
c) ½ + ¼ + 1/6 + ……
sum= (num/2)*(2+(num-1))
OUTPUT-1
OUTPUT-2
OUTPUT- 1
OUTPUT- 2
n1, n2 = 0, 1
count = 0
if nterms <= 0:
elif nterms == 1:
print(n1)
else:
print("Fibonacci sequence:")
print(n1)
nth = n1 + n2
n1 = n2
n2 = nth
count += 1
OUTPUT- 1
Fibonacci sequence:
13
21
34
13.# Program to find out the length of the string.
OUTPUT- 1
OUTPUT- 2
n=int(input("Enter a number:"))
tot=0
while(n>0):
dig=n%10
tot=tot+dig
n=n//10
OUTPUT- 1
Enter a number:22
OUTPUT- 2
Enter a number:484