AP Mod 3

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Mod 3 : Function Chapter

Short question

a. What is the purpose of pass statement in function, write with an example.


b. What is the purpose of return statement ? write with an example.
c. Give example of a default parameter value in function.

5 mark question

d.Create a list of 5 subjects. Define a function disp_sub to display the subjects


line by line with serial numbers. Pass the list name as argument. At last print
how many subject names were passed.

e.Explain the use of Arbitrary keyword argument **kwargs using an example


in function

Matplotlib and Seaborn Package in Python

Short question

Short questions on Data visualization, scatter plot, histogram, Bar plot, what are
popular plotting libraries in python

Using “Toyota.csv” write python code to draw a scatter plot between age and price.
With output graph.

Draw a histogram of “KM” field showing output graph.

Long question

1. Consider a dataset “Toyota.csv” with the following columns and there are 1000
rows.

Price Age KM FuelType HP MetColor Automatic CC Doors Weight

Write python code to answer the following questions.

a. Read the csv file to a data frame cars_data.


b. Display the columns of cars_data.
c. Display how the dimension of cars_data (no. of rows and columns)
d. Display the first 10 rows of data frame and index 2nd to index 6th columns
using iloc [ ].
e. Using loc[ ] display the rows 500 to 550 and columns Price,HP and Weight
f. Using crosstab ( ) display the count of different Fuel Types.

You might also like