Practical File Ai 24-25
Practical File Ai 24-25
teacher Vishal Khanna, PGT (CS), [DPS Azaad Nagar] for his invaluable
I am also greatly indebted to our principal Mrs. Shilpa Manish and school
authorities for providing me with the facilities and requisite laboratory conditions
[ADITYA BHATIA]
CERTIFICATE
, student of Class X, DPS Azaad Nagar has completed the PRACTICAL FILE
during the academic year 2024-25 towards partial fulfillment of credit for the
Date:
if(x>y):
print("x is greater")
else:
print("y is greater")
Percentage >=95 A+
Percentage >=90 and percentage <95 A
Percentage >=80 and Percentage<90 B
Percentage >=70 and percentage<80 C
Percentage <70 D
if(p>=95):
print("A+")
elif(p>=90 and p<95):
print("A")
elif(p>=80 and p<90):
print("B")
elif(p>=70 and p<80):
print("C")
else:
print("D")
4. WAP to input a number and print number is Palindrome or not .
6. WAP input a number and print Reverse of given number Ex->234 to 432
7. WAP input 4 digits number and print Sum of Digits Ex-> 1234 to 10
L=[4,7,8,9,3,4,5,89]
lenght=len(L)
sum=0
for i in range(0,lenght):
sum=sum+L[i]
print "sum all element of list",sum
10. Write a program that reads a string and print Reverse string. Input :
‘Hello’ Output ‘olleH’.
11. Write a program that reads a string and check whether it is a Palindrome string
or not. Input : ‘nitin’ Output : ‘yes it is palindrome’.
14. Write a program to input a number and print Factorial of given number.
num = int(input("Enter a number: "))
factorial = 1
# check if the number is negative, positive or zero
if num < 0:
print("Sorry, factorial does not exist for negative numbers")
elif num == 0:
print("The factorial of 0 is 1")
else:
for i in range(1,num + 1):
factorial = factorial*i
print("The factorial of",num,"is",factorial)
15. Write a code to compute the n th Fibonacci number.
def Fib(n):
a,b = 0,1
print a,b,
for i in range(n):
c=a+b
print c,
a=b
b=c
Fib(10)
17. Write a program to take a list and convert it into an array and print (Using
Numpy) import numpy as np
l=[1,2,3,4]
a=np.array(l)
print("Array is :", a)
print("Multiply by 2 in Array",a*2)
print("Multiply by 2 in list",l*2)
import pandas as pd
#Creating Dictionary to store data d={'Name':['Anil','Bhavna','Chirag','Dhara','Giri'],'Score':
[25,20,22,23,21],'Attempts':[1,2, 2,1,1],'Qualified':['Yes','No','Yes','Yes','No']} #Creating a
dataframe
df=pd.DataFrame(d,index=['C001','C002','C003','C004','C005'])
print(df)
20. Write a Python program to plot the function y = x 2 using the pyplot or matplotlib
libraries.
import matplotlib.pyplot as pl
import numpy as np
x=np.arange(1,9)
y=x*x
pl.plot(x,y)
pl.show()
21. Write a python program to plot two or more lines with different styles.
import matplotlib.pyplot as pl
import numpy as np
val=[[5.,25.,15.,20.],[4.,23.,8.,17.],[6.,22.,47.,19.]]
x=np.arange(4)
pl.plot(x,val[0],color='b',
label='range1')
pl.plot(x,val[1],color='g',
label='range2') pl.plot(x,val[2],color='r',
label='range3') pl.legend(loc='upper
left') pl.title("multirange line chart")
pl.show()
22. Write to create a pie for sequence con=[23.4,17.8,25,34,40]
for Zones=[‘East,’West’,”North’,’South’,’Central’]
a. Show North zone’s value exploded
b. Show % contribution for each Zone.
c. The pie chart should be circular.
import matplotlib.pyplot as pl
import numpy as np
con=[23.4,17.8,25,34,40]
Zones=['East','Wast','North','South','Central']
pl.axis("equal")
pl.pie(con,labels=Zones,explode=[0,0.1,0.2,0,0],autopct="%1.1f%%")
pl.show()
import cv2
import matplotlib.pyplot as plt
import numpy as np
#Load the image file into memory
img = cv2.imread('dps.jpg') #Display Image
plt.imshow(img)
plt.title('DPS Azaad Nagar')
plt.axis('off')
plt.show()
24. Write a menu-driven program to calculate the mean, mode and median for the given data:
[5,6,1,3,4,5,6,2,7,8,6,5,4,6,5,1,2,3,4]
mport statistics #Creating list
l=[5,6,1,3,4,5,6,2,7,8,6,5,4,6,5,1,2,3,4]
#Display mean, mode and median value using functions
print("Mean Value:%.2f"%statistics.mean(l))
print("Mode Value:%.2f"%statistics.mode(l))
print("Median Value:%.2f"%statistics.median(l))
25. Create your own pixels on piskelapp (https://www.piskelapp.com/) and make a gif
image. Open piskelapp on your browser.
Apply background for the picture.
Use pen to draw letter A
Copy the layer and paste it
Now erase letter A written previously
Apply the background colour for layer 2
Change the pen colour and Write I
Export the image.
Follow this link to access animated GIF:
https://piskel-imgstore-b.appspot.com/img/48da25a6-5743-11ed-acee-17e8d17e27f5.gif