Central Board of Secondary Education Amity International School Sector-1, Vasundhara, Ghaziabad
Central Board of Secondary Education Amity International School Sector-1, Vasundhara, Ghaziabad
Central Board of Secondary Education Amity International School Sector-1, Vasundhara, Ghaziabad
SUBMITTED BY:
SUBJECT TEACHER(AI):
CLASS: SEC
ROLL NO:
ACKNOWLEDGEMENT
…………………………………..
CERTIFICATE
This is to certify that ………………………………………. , student of Class
X of ………………………………………….. has completed the PRACTICAL
FILE during the academic year ……………………………… towards
partial fulfilment of credit for the ARTIFICIAL INTELLIGENCE
practical evaluation of 2024-25 and submitted satisfactory report,
as compiled in the following pages, under my supervision.
…………………………. …………………………..
Internal Examiner Signature External Examiner Signature
Date:
School Seal
Principal Signature
UNIT 3: Advanced Python
1. Write a program to compute the net run rate for a tournament.
tn=input("Enter Team name:")
n=int(input("Enter no. of matches played:"))
tr=0
to=0
tagr=0
togr=0
for i in range(n):
r=int(input("Enter runs scored in match"+str(i+1)+":"))
o=int(input("Enter overs played:"))
tr=r+tr
to=to+o
agr=int(input("Enter runs conceded in match"+str(i+1)+":"))
ogr=int(input("Enter overs bowled:"))
tagr+=agr
togr+=ogr
nrr=(tr/to)-(tagr/togr)
print("Net runrate is:",nrr)
3. Write a program to find the maximum number out of the given three numbers.
n1=int(input("Enter the Number1:"))
n2=int(input("Enter the Number2:"))
n3=int(input("Enter the Number3:"))
if n1>n2 and n1>n3:
print(n1, " - Number 1 is greater")
elif n1>n2 and n1>n3:
print(n2, " - Number 2 is greater")
elif n3>n1 and n3>n2:
print(n3, " - Number 3 is greater")
else:
print("All are same")
Write a program that read the customer number & power consumed and prints the
amount to be paid by the customer. Note that output should be well formatted.
cno=int(input("Enter Cusumer Number:"))
pc=int(input("Enter power consumed:"))
if pc>0 and pc<=100:
bill_amt=pc*1
elif pc>100 and pc<=300:
bill_amt=100+(pc-100)*1.25
elif pc>300 and pc500:
bill_amt=650+(pc-500)*1.75
else:
print("Invalid Power Consumed Units")
print("~"*60)
print("\t\tABC Power Company Ltd.")
print("~"*60)
print("Consumer Number:",cno)
print("Consumed Units:",pc)
print("------------------------------")
print("Bill Amount:",bill amt)
n=int(input("Enter n:"))
k=1
for i in range(1,n+1):
for j in range(1,i+1):
k=k+1
print()
8. Write a program to create a list of students' marks with user-defined values and
find the maximum.
l.append(m)
print("Maximum marks scored:",max(l)
9. Write a program to count the frequency of every element in a given list.
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)
If num >1:
If(num%i==0):
break
else:
else:
14.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
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))
15.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 matplotlib.pyplot as plt
games=['Pubg', 'FreeFire', 'MineCraft', 'GTA-V','Call of duty', 'FIFA 22']
rating=[4.5,4.8,4.7,4.6,4.1,4.3]
plt.bar(games,rating,color=['black', 'red', 'green', 'blue', 'yellow'])
plt.title("Games Rating 2022")
plt.xlabel('Games')
plt.ylabel('Rating')
plt.legend()
plt.show()
16.Consider the following data of a clothes store and plot the data on the line chart: