Practical Lab Manual
Grade 10
Subject: Artificial Intelligence
1. Consider the average heights and weights of persons aged 8 to 16 stored in the
following two lists: height = [121.9,124.5,129.5,134.6,139.7,147.3, 152.4,
157.5,162.6] weight= [19.7,21.3,23.5,25.9,28.5,32.1,35.7,39.6, 43.2]
Let us plot a line chart where:
i. x axis will represent weight
ii. y axis will represent height
iii. x axis label should be “Weight in kg”
iv. y axis label should be “Height in cm”
v. colour of the line should be green
vi. vi. use * as marker
vii. Marker size as10
viii. The title of the chart should be “Average weight with respect to average
height”.
ix. Line style should be dashed x. Linewidth should be 2.
2. Write a program that asks the user to enter one's name and age. Print out a message
addressed to the user that tells the user the year in which he/she will turn 100 years
old.
3. The record of a student (Name, Roll No, Marks in five subjects and percentage of
marks) is stored in the following list:
stRecord = ['Raman','A-36', [56,98,99,72,69], 78.8]
Write Python statements to retrieve the following information from the list stRecord.
a) Percentage of the student
b) Marks in the fifth subject
c) Maximum marks of the student
d) Roll No. of the student
e) Change the name of the student from ‘Raman’ to ‘Raghav’
4. Write a program to read a list of n integers (positive Notes as well as negative).
Create two new lists, one having all positive numbers and the other having all
negative numbers from the given list. Print all three lists.
5. Write a program to find the largest and the second largest elements in a given list of
elements.
6. Write a program to read a list of elements. Modify this list so that it does not contain
any duplicate elements i.e. all elements occurring multiple times in the list should
appear only once.
7. Write a Python program to find the highest 2 values in a dictionary.
8. Write a program to input your friend’s, names and their phone numbers and store
them in the dictionary as the key-value pair. Perform the following operations on the
dictionary:
a) Display the Name and Phone number for all your friends.
b) Add a new key-value pair in this dictionary and display the modified dictionary
c) Delete a particular friend from the dictionary
d) Modify the phone number of an existing friend
e) Check if a friend is present in the dictionary or not
f) Display the dictionary in sorted order of names
9. Program to print the multiples of 10 for numbers in a given range.
10. Program to print even numbers in a given sequence using for loop.
11. Write a program to find the number of times an element occurs in the list.
12. Create the following Series and do the specified operations:
a) EngAlph, having 26 elements with the alphabets as values and default index
values.
b) Vowels, having 5 elements with index labels ‘a’, ‘e’, ‘i’, ‘o’ and ‘u’ and all the
five values set to zero. Check if it is an empty series.
c) Friends, from a dictionary having roll numbers of five of your friends as data and
their first name as keys.
d) MTseries, an empty Series. Check if it is an empty series.
e) MonthDays, from a numpy array having the number of days in the 12 months of
a year. The labels should be the month numbers from 1 to 12.
13. Write commands for the following:
a) Set all the values of Vowels to 10 and display the Series.
b) Divide all values of Vowels by 2 and display the Series.
c) Create another series Vowels1 having 5 elements with index labels ‘a’, ‘e’, ‘i’, ‘o’
and ‘u’ having values [2,5,6,3,8] respectively.
d) Add Vowels and Vowels1 and assign the result to Vowels3.
e) Subtract, Multiply and Divide Vowels by Vowels1.
f) Alter the labels of Vowels1 to [‘A’, ‘E’, ‘I’, ‘O’, ‘U’].
14. Create the following DataFrame Sales containing year wise sales figures for five
sales persons in INR. Use the years as column labels, and sales person names as row
labels.
Use the DataFrame created in Question 16 above to do the following:
a) Display the row labels of Sales.
b) Display the column labels of Sales.
c) Display the data types of each column of Sales.
d) Display the dimensions, shape, size and values of Sales.
e) Display the last two rows of Sales.
f) Display the first two columns of Sales.
g) Create a dictionary using the following data. Use this dictionary to create a
DataFrame Sales2.
15. Assuming the given table: Product. Write the python code for the following:
a) To create the data frame for the above table.
b) To add the new rows in the data frame.
c) To display the maximum price of LG TV.
d) To display the Sum of all products.
e) To display the median of the USD of Sony products
16. Write the python statement for the following question on the basis of given dataset:
a) To create the above DataFrame.
b) To print the Degree and maximum marks in each stream.
c) To fill the NaN with 76. d) To set the index to Name.
e) To display the name and degree wise average marks of each student.
f) To count the number of students in MBA.
g) To print the mode marks BCA.
17. Let us write a Python script to display Bar plot for the “student_info.csv” file with
column Day on x axis, and having the following customisation:
● Changing the color of each bar to red, yellow and purple.
● Edgecolor to green
● Linewidth as 2
● Line style as "--"
18. Develop and write the code of student marks predictor in a practical file.
19. Plot the following data using a line plot:
a) Before displaying the plot display “Monday, Tuesday, Wednesday, Thursday,
Friday, Saturday, Sunday” in place of Day 1, 2, 3, 4, 5, 6, 7
b) Change the color of the line to ‘Magenta’
20. Collect data about colleges in Delhi University or any other university of your choice
and number of courses they run for Science, Commerce and Humanities, store it in a
CSV file and present it using a bar plot.
21. Unit- 4: Statistical Data
Activity: Excel for Statistical Analysis
Link:
https://docs.google.com/spreadsheets/d/1f5G-
JXyP7EV2fy1hax47YVaH5gyq8KZy/edit?gid=1552557748#gid=1552557748
Perform the activities mentioned in a link and note down the observations in a practical
file.