Class 10th AI...
Class 10th AI...
PracticalFile Of
Artificial
intelligence Subject
Code - 417
(Session-2023-24)
10th daisy
TableofContents
Output :
2) Program to make the bar graph.
Import matplotlib.pyplot as plt
Categories = [‘Category A’, ‘Category B’, ‘Category C’, ‘Category
D’]
Values = [30, 45, 15, 25]
Plt.bar(categories, values, color=’skyblue’)
Plt.xlabel(‘Categories’)
Plt.ylabel(‘Values’)
Plt.title(‘Bar Chart Example’)
Plt.show()
3) Program to find the uses of mobile phone in different area.
Import matplotlib.pyplot as plt
Area= [‘iqbal nagar’, ‘gandhi nagar’, ‘shanti nagar’, ‘dalip nagar’]
Peopleuses = [30, 45, 15, 25]
Plt.bar(area, peopleuses, color=’red’)
Plt.xlabel(‘area’)
Plt.ylabel(‘people uses’)
Plt.title(‘mobile phone uses’)
Plt.show()
Output:
4)Program for making a histogram.
import matplotlib.pyplot as plt
import numpy as np
data = np.random.randn(1000)
plt.hist(data, bins=30, color='skyblue', edgecolor='black')
plt.xlabel('Values')
plt.ylabel('Frequency')
plt.title('Histogram Example')
plt.show()
Output:
5)program for making scatter graph.
Import matplotlib.pyplot as plt
Import numpy as np
X = np.random.rand(5)
Y = np.random.rand(5)
Plt.scatter(x, y, color=’green’, marker=’o’, label=’Scatter’)
Plt.xlabel(‘X-axis’)
Plt.ylabel(‘Y-axis’)
Plt.title(‘Scatter Plot ’)
Plt.legend()
Plt.show()
Output:
6)program to make line graph.
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 10, 100)
y = np.sin(x)
plt.plot(x, y, color='blue', linestyle='-', label='Line')
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.title('Line Graph')
plt.legend()
plt.show()
Output:
7) program for making double line graph.
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 10, 100)
y1 = np.sin(x)
y2 = np.cos(x)
plt.plot(x, y1, color='blue', linestyle='-', label='Line 1')
plt.plot(x, y2, color='red', linestyle='--', label='Line 2')
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.title('Double Line Graph')
plt.legend()
plt.show()
output:
8) program to find the diffrances of prices.
Import matplotlib.pyplot as plt
Import numpy as np
Days = np.arange(1, 11)
Price_stock1 = np.random.randint(50, 100, size=10)
Price_stock2 = np.random.randint(40, 90, size=10)
Price_difference = price_stock1 – price_stock2
Plt.plot(days, price_stock1, label=’Stock 1’, marker=’o’)
Plt.plot(days, price_stock2, label=’Stock 2’, marker=’o’)
Plt.plot(days, price_difference, label=’Price Difference’,
linestyle=’—‘, marker=’o’)
Plt.xlabel(‘Days’)
Plt.ylabel(‘Prices’)
Plt.title(‘Double Line Graph – Price Difference’)
Plt.legend()
Plt.show()
9)Program to print the sum of natural numbers.
sum=0
for n in range(1,8):
sum+=n
print("sum of natural numbers<=",n,"is",sum)
Output:
Output:
blue
green
yellow
orange
red
Brown
11)Program to print table of a number, say5.
num=5
for i in range(1,11):
print(num,'x',i,'=',num*i)
Output:
5x1=5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
5 x 6 = 30
5 x 7 = 35
5 x 8 = 40
5 x 9 = 45
5x 10 = 50
12)Program to print total marks of different subjects.
marks=[98,79,69,71,65]
print("marks are:",marks)
total=0
for sm in marks are: [98, 79, 69, 71, 65]
total=total+sm
print("the total marks are:",total)
Output:
Output:
1
4
9
16
25
14) Program to input a number(num) and print the sum .
sum=0
num=int(input("please enter a number:"))
for i in range(1,(num+1)):
sum=sum+i
print("sum of numbers 1to",num,"is",sum)
Output:
Output:
Output:
Output:
18)program to create the original photo to sketch photo
import cv2
img = cv2.imread('dog.jpg')
edges = cv2.Canny(img,200,300,True)
cv2.imshow("Edge Detected Image", edges)
cv2.imshow("Original Image", img)
cv2.waitKey(0) # waits until a key is pressed
cv2.destroyAllWindows() # destroys the window showing image
Output:
19)program to create original photo to bilateral photo
import cv2
img = cv2.imread('dog.jpg')
cv2.imshow('Original Image',img)
cv2.destroyAllWindows()
output: