Class X Practical File Artificial Intelligence For 2022-23
Class X Practical File Artificial Intelligence For 2022-23
NAUSENABAUGH
2023-24
SUBMITTED BY:
, student
3 Unit 5 Computer
Vision
21 Visit https://www.w3schools.com/colors/colors_rgb.asp.
On the basis of this online tool, try and write answers of all the
below-mentioned questions.
What is the output colour when you put R=G=B=255?
What is the output colour when you put R=G=255,B=0?
What is the output colour when you put R=255,G=0,B=255?
What is the output colour when you put R=0,G=255,B=255?
AI CLASS 10 PRACTICAL RECORD FILE
print("
print("Bill Amount:",bill_amt)
AI CLASS 10 PRACTICAL RECORD FILE Page 3
5. Write a program to check whether the entered number is Armstrong or not.
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):
AI CLASS 10 PRACTICAL RECORD FILE Page 5
for j in range(1,i+1):
print(k,end=" ")
k=k+1
print()
8. Write a program to create a list of students' marks with user-defined values
and find the maximum.
n=int(input("Enter no. of
l=[]
listfor 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]
n=int(input("Enter
#Take input for no of no. of
#Creating empty
l=
#Accepting marks and appending marks into the listfor
in
m=int(input("Enter
l.append( #Swapin
elemen for i
range(len(l)
if l[i] % 5 ==
l [ i ], l [i-1] = l [ i - 1 ] , l [i]
print("List after
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
arr=np.arange(5,45,5)
arr=arr.reshape(2,4)
#printing array
print(arr)
#Import
AI CLASS NumPy
10 PRACTICAL Package
RECORD FILE Page 8
import numpy as np
#Creating empty list
l = []
#Take input for n no. of elements
n=int(input("Enter the no. of elements:"))
#Append the values into the list
for i in range(n):
val=int(input("Enter value "+str(i+1)+":"))
l.append(val)
#Converting list into numpy array
arr=np.array(l)
print("Array:",arr)
13.Write a program to create a data frame named player and store their data in
the columns like team, no. of matches, runs, and average. Assign player name as
row index and Display only those player details whose score is more than 1000.
#import pandas package import pandas as pd
#Creating Dictionary to store data d={'Team':['India','Pakistan','England','Asutralia'],
'Matches':[25,23,19,17],
'Runs':[1120,1087,954,830], 'Average':[44.80,47.26,50.21,48.82]}
#Creating a dataframe
player=pd.DataFrame(d,index=['Virat kohli','Babar Azam','Ben Stokes','Steve Smith'])
#Displaying data whose runs > 1000 print(player[player['Runs']>1000])
14.Write a program to represent the data on the ratings of mobile games on bar
chart. The sample data is given as: Pubg, FreeFire, MineCraft, GTA-V, Call
of duty, FIFA 22. The rating for each game is as: 4.5,4.8,4.7,4.6,4.1,4.3.
#Import package for Matplot Library
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))
17. 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))
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: Clic k
import cv2
import numpy as np
img = cv2.imread('octopus.png')
#Display Image
plt.imshow(img)
plt.title('Octopus')
plt.axis('off')
plt.show()