Practical File Artificial Intelligence Class 10 For 2023-24
Practical File Artificial Intelligence Class 10 For 2023-24
Practical File Artificial Intelligence Class 10 For 2023-24
CLASS: X-C
ROLL NO: 4
AKSHITA KAMBOJ
supervision.
multiple for i in
range(1,11):
2 3
4 5 6
7 8 9 10
11 12 13 14 15
n=int(input("Enter n:"))
#Generating Pattern
k=1
for i in range(1,n+1):
for j in range(1,i+1):
print(k,end=" ")
k=k+1
print()
l=[]
for i in range(n):
m=int(input("Enter marks:"))
l.append(m)
9. Write a program to create a list of numbers and swap the content with the next value
divisible by 5.
For example: list = [4,25,31,7,35,44,55]
Output: [25,4,31,35,7,55,44]
#Take input for no of subjects
n=int(input("Enter no. of subjects:"))
#Creating empty list
l=[]
#Accepting marks and appending marks into the list
for i in range(n):
m=int(input("Enter marks:"))
l.append(m)
#Swaping elements
for i in range(len(l)) :
if l[i] % 5 == 0 :
l [ i ], l [i-1] = l [ i - 1 ] , l [i]
print("List after swap:",l)
l = []
for i in range(n):
l.append(val)
f = {}
for i in l:
if (i in f):
f[i] += 1
else:
f[i] = 1
for i, j in f.items():
print(i, "->", j)
import numpy as np
function arr=np.arange(5,45,5)
arr=arr.reshape(2,4)
#printing array
print(arr)
14.Write a program to create a data frame to store data of candidates who appeared
in interviews. The dataframe columns are name, score, attempts, and qualify
(Yes/No). Assign rowindex as C001, C002, and so on.
#import pandas package
import pandas as pd
['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'])
#Printing a dataframe
print(df)
rating=[4.5,4.8,4.7,4.6,4.1,4.3]
plt.xlabel('Games')
plt.ylabel('Rating')
plt.legend();plt.show()
#Import pyplot
import matplotlib.pyplot as pp
#Prepraing data
mon =['January','February','March','April','May','June'] sales =
[2500,2100,1700,3500,3000,3800]
#Crating line chart
pp.plot(mon,sales,label='Sales',color='r',linestyle='dashed', linewidth=4,\
marker='o', markerfacecolor='k', markeredgecolor='b')
#Customizing the chart
pp.title("Sales Report")
pp.xlabel("Months")
pp.ylabel("Sales")
pp.legend()
pp.show()
[5,6,1,3,4,5,6,2,7,8,6,5,4,6,5,1,2,3,4]
#import statistics
import 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))
20. Write a program to calculate variance and standard deviation for the given
data: [33,44,55,67,54,22,33,44,56,78,21,31,43,90,21,33,44,55,87]
#import statistics
import statistics
#Creating list
l=[33,44,55,67,54,22,33,44,56,78,21,31,43,90,21,33,44,55,87]
print("Variance:%.2f"%statistics.variance(l))
print("Standard Deviation:%.2f"%statistics.stdev(l))
Solution:
1. White
Steps:
1. Open piskelapp on your browser.
2. Apply background for the picture.
3. Use pen to draw letter A
4. Copy the layer and paste it
5. Now erase letter A written previously
6. Apply the background colour for layer 2
7. Change the pen colour and Write I
8. Export the image.
9. Follow this link to access animated GIF: Click here
import cv2
import numpy as np
img =
cv2.imread('octopus.png')
#Display Image
plt.imshow(img)
plt.title('Octopus')
plt.axis('off')
plt.show()