0% found this document useful (0 votes)
45 views

Class 10 - Ai Practical File

Uploaded by

mayurid757
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views

Class 10 - Ai Practical File

Uploaded by

mayurid757
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Artificial Intelligence –practical file

INDEX
Sr.no Topic Date sign
1 To calculate area and perimeter of rectangle
2 To find greater of two numbers
3 Accept marks in 3 subjects, Calculate Total,
Average and display Grade
4 Accept cost price, selling price and display
the profit or loss incurred
5 Display odd numbers till 30 using while loop
6 program to print numbers till which the user
wants using while loop
7 Create a list having names of 5 flowers and
5 numbers and display the elements using
for loop
8 Adding odd and even numbers into list using
loops
9 Write a program to print a multiplication
table of the entered number using for loop.
10 Display consecutive numbers from 25 to 40
in ascending order using for loop
11 Analyse data and plot the data on the line
chart
12 plot data on bar chart
13 plot data on pie chart
14 To calculate mean, median, mode
15 Display image using computer vision
16 Display image in Gray Scale
Unit 3-Advanced python
1. To calculate area and perimeter of rectangle
# program to calculate area and perimeter of rectangle

length = float(input("Enter Length "))


breadth = float(input("Enter Breadth "))
area = length * breadth
perimeter = 2 * (length + breadth)
print ("Area of rectangle is ",area)
print ("Perimeter of rectangle is ",perimeter)

2. To find greater of two numbers


# program to compare number
n1=int(input("Enter first number :"))
n2=int(input("Enter second number :"))

if(n1>n2):
print("The first number",n1,"is greater")
elif(n2>n1):
print("The second number",n2,"is greater")
else:
print("both numbers are equal")
3. Accept marks in 3 subjects, Calculate Total, Average and display Grade
#program to check grades using elif
sci = float(input("Enter science marks : "))
eng = float(input("Enter english marks : "))
ss = float(input("Enter social science marks : "))
total = sci + eng + ss
print ("The total marks are ", total)
percent = total/300 * 100
print ("Your percentage is ", percent)
if (percent >= 75) :
print ("Grade is Distinction.")
elif (percent >= 60) :
print ("Grade is First Class.")
elif (percent >= 45) :
print ("Grade is Second Class.")
elif (percent >= 33) :
print ("Grade is Pass.")
else :
print ("You have Failed.")
4. Accept cost price, selling price and display the profit or loss incurred
# program to print profit or loss
sp = float(input("Enter selling price : "))
cp = float(input("Enter Cost price : "))

if (sp>cp) :
p=sp-cp
print ("You have made a profit of",p,"rupees")
elif (cp>sp) :
l=cp-sp
print("You have made a loss",l,"rupees")
else :
print ("You have made no profit or loss ")

5. Display odd numbers till 30 using while loop


#program to print odd numbers upto 30
count=1
while (count<=30):
print(count)
count=count+2
6. program to print numbers till which the user wants using while
loop
# program to print numbers till which the user wants
n=int(input("enter any number :"))
count=0
while (count<=n):
print(count)
count=count +1

7. Create a list having names of 5 flowers and 5 numbers and


display the elements using for loop
# program to print elements of a list using for
flowers = ['rose', 'lily', 'jasmine', 'mogra', 'lotus']
for i in flowers:
print (i)
print()
num=[34,89,100,24.8,67.9]
for i in num:
print(i)
8. Adding odd and even numbers into list using loops
#program to add odd/even numbers into a list using for loop
odd = []
even = []
for i in range (10):
n=int(input("Enter any number "))
if (n % 2 == 0):
even.append(n)
else:
odd.append(n)

print('odd numbers in list are ',odd)


print ('even numbers in list are ',even)
9. Write a program to print a multiplication table of the entered
number using for loop.
# program to display multiplication table using for loop
num = int(input("Enter any number "))
for i in range(1,11):
print (num, " * ", i, " = ", num*i)
print()
10. Display consecutive numbers from 25 to 40 in ascending
order using for loop
#program to display numbers in a range
for i in range(25,41):
print(i)
Data science
11. Consider the following data of a clothes store and plot the data
on the line chart:
Customize the chart as you wish
Month sales
March 1500
April 3500
May 6500
June 5800

#program to plot data on line chart


import matplotlib.pyplot as plt
month =['March','April','May','June']
sales =[1500,3500,6500,5800]
plt.plot(month, sales)
plt.title("Sales for the month")
plt.xlabel("Months")
plt.ylabel("amt in rs")
plt.show()
12. Consider the following data and plot it on bar chart
Houses Amount
Prema 300
Shanti 400
Ananda 450
Satya 350

#program to plot data on bar chart


import matplotlib.pyplot as plt
houses =['prema','shanti','ananda','satya']
amount =[300,400,450,350]
plt.bar(houses,amount)
plt.title("contributions")
plt.xlabel("houses")
plt.ylabel("amt in rs")

13. Consider the following data and plot it on pie chart


Seats Party
BJP 125
ShivSena 300
Congress 110
NCP 35
# program to plot data on pie chart
import matplotlib.pyplot as plt
seats =[125,300,110,34]
party =["bjp","shiv sena","congress","ncp"]
plt.pie(seats,labels=party)
plt.title("seats tally")

14. Write a program to calculate mean, median, mode


# program to display mean, median, mode
import statistics
marks=[3,56,7,12,33,56]
m1=statistics.mean(marks)
print("the mean of marks is",m1)
m2=statistics.median(marks)
print("the median of marks is",m2)
m3=statistics.mode(marks)
print("the mode of marks is",m3)

Computer vision
15. Display image using computer vision
#program to display image
import cv2
img=cv2.imread(r"C:\Users\LAB-4-SMV-84\Desktop\pic1.jpg",1)
cv2.imshow("original",img)
cv2.waitKey()

OR
#program to display image using matplotlib
import cv2
import matplotlib.pyplot as plt
img=cv2.imread(r"C:\Users\Desktop\pic1.jpg")
plt.title("flowers")
plt.imshow(img)

16. Display image in Gray Scale


# program to show image in grayscale color
import cv2
import matplotlib.pyplot as plt
img=cv2.imread(r"C:\Users\Desktop\pic1.jpg")
plt.imshow(cv2.cvtColor(img,cv2.COLOR_BGR2GRAY))
plt.show()

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy