Practical File X (Ai - 417)
Practical File X (Ai - 417)
CLASS: [X]
ROLL NO: [ ]
Page 1
ACKNOWLEDGEMENT
I wish to express my deep sense
of gratitude and indebtedness to our
learned teacher MRS. REKHA CHAUHAN,
TGT COMPUTER INSTRUCTOR, K.V.
BHANDUPSHIFT-1 for his invaluable
help, advice and guidance in the
preparation of this project.
[Name of Student]
Page 2
CERTIFICATE
supervision.
Principa
l
Signature
Page 3
No Practical Date Signature
1 Unit 3 Advanced Python Programs
1 Write a program to compute the net run rate for a tournament.
2 Write a program to check whether the given character is an
uppercase letter or lowercase letter or a digit or a special
character.
3 Write a program to find the maximum number out of the given
three numbers.
4 An electric power distribution company charges its domestic
consumers as follows:
Page 4
No Practical Date Signature
8 Write a program to create a list of students' marks with user-
defined values and find the maximum.
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]
10 Write a program to count the frequency of every element in a
given list.
2 Unit 4 Data Science Programs
11 Write a program to create a 2D array using NumPy.
12 Write a program to convert a python list to a NumPy array.
13 Write a program to create matrix of 3x3 from 11 to 30.
14 Write a program to create a data frame to store data of candidates
who appeared in interviews. The data frame columns are name,
score, attempts, and qualify (Yes/No). Assign row index
as
C001, C002, and so on.
15 Write a program to create a dataframe 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.
16 Write a program to represent the data on the ratings of mobile
games on bar chart. The sample data is given as:
Games:Pubg, FreeFire, MineCraft, GTA-V, Callofduty, FIFA 22.
Rating: 4.5,4.8,4.7,4.6,4.1,4.3.
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]
18 Write a menu-driven program to calculate the mean, mode and
median for the given data: [5,6,1,3,4,5,6,2,7,8,6,5,4,6,5,1,2,3,4]
Page 5
No Practical Date Signature
19 Consider the following data of a clothes store and plot the data on
the line chart and customize the chart as you wish:
Month Jeans T-Shirts Shirts
March 1500 4400 6500
April 3500 4500 5000
May 6500 5500 5800
June 6700 6000 6300
July 6000 5600 6200
August 6800 6300 4500
20 Observe the given data for monthly sales of one of the salesmen
for 6 months. Plot them on the line chart.
Month January February March April May June
Sales 2500 2100 1700 3500 3000 3800
Page 6
What is the output colour when you put R=G=B=0?
What is the output colour when you Put R=0,G=0,B=255?
What is the output colour when you Put R=255,G=0,B=0?
What is the output colour when you put R=0,G=255,B=0?
What is the value of your colour?
Page
Q1.
Solution
#Enter details for team, for and against data
tn=input("Enter Team name:")
n=int(input("Enter no. of matches played:"))
#variables to store total scores and overs
tr=0
to=0
tagr=0
togr=0
#Entering runs and overs and adding them for n number of matches
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
#Computing the net runrate
nrr=(tr/to)-(tagr/togr)
#Displaying the net runrate
print("Net runrate is:",nrr)
Q2
Solution
#Input the character to check
ch=input("Enter Any Character:")
'''Checking whether it is upperletter or
lowerletter or digit or a special character'''
if ch.isupper():
print(ch, " is an upper case letter")
elif ch.isupper():
print(ch, " is a lower case letter")
elif ch.isdigit():
print(ch, " is a digit")
elif ch.isspace():
print(ch, " is a space")
else:
print(ch," is a special character")
Q3
Solution
#Take input or three number to compare
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")
Q4
Solution
#Input Data
cno=int(input("Enter Cusumer Number:"))
pc=int(input("Enter power consumed:"))
#Computing bill amount based on 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 pc<500:
bill_amt=350+(pc-300)*1.50
elif pc>500:
bill_amt=650+(pc-500)*1.75
else:
print("Invalid Power Consumed Units")
#Printing the bill in proper format
print("~"*60)
print("\t\tABC Power Company Ltd.")
print("~"*60)
print("Consumer Number:",cno)
print("Consumed Units:",pc)
print("------------------------------")
print("Bill Amount:",bill_amt)
Q5
Solution
#Enter a number to check
n=int(input("Enter number to check:"))
#Store the original number into temporary variable
t=n
s=0
#Computing the sum of cube of each digit and iterating until n=0
while n!=0:
r=n%10
s=s+(r**3)
n//=10
#Checking & displaying whether armstrong or not
if t==s:
print(s," is Armstrong number")
else:
print(s," is not an Artmstrong number")
Q6
Solution
#Take input to accept a nmuber for printing Multiplication table
n=int(input("Enter number to print multiplication table:"))
#Take for loop for multiple
for i in range(1,11):
print(n," x ", i, " = ", n*i )