0% found this document useful (0 votes)
8 views5 pages

Python and Data Analysis Practice Assignments

The document outlines a series of practice assignments across four weeks, covering topics such as variable naming, data types, list manipulation, scatter plots, and linear regression. It includes multiple-choice questions related to Python programming and data analysis concepts. Each week focuses on different aspects of programming and data science, providing practical exercises for learners.

Uploaded by

sreenivasulu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views5 pages

Python and Data Analysis Practice Assignments

The document outlines a series of practice assignments across four weeks, covering topics such as variable naming, data types, list manipulation, scatter plots, and linear regression. It includes multiple-choice questions related to Python programming and data analysis concepts. Each week focuses on different aspects of programming and data science, providing practical exercises for learners.

Uploaded by

sreenivasulu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Week 1: Practice Assignment 1

Your last recorded submission was on 2025-09-14, 12:40 IST


Which of the following is a valid variable name?

.ram2

ram.2

ram_2

2ram00
Which of the following statement is invalid?

m_n_q = 3500

m.n.q = 3500, 3600, 3700

m,n,q = 3500, 3600, 3700

mnq = 350036003700
Assignment operator used in Python is: -

==

>>

<-

=
Which command would you use to find the data type of a variable

data( )

type( )

typeof( )

str( )

What will be the output after the following statements are executed?

X=300
Y= 17
X%=Y
print(X)

11

17.6

300
17

 nitially, X is 300.
 Y is 17.
 X %= Y means X = X % Y — the remainder when X is divided by Y.

Calculate 300 % 17:

 17 * 17 = 289 (closest multiple of 17 less than 300)


 300 - 289 = 11

So, X becomes 11.

Week 2: Practice Assignment 2


Variable ‘a’ is defined as
a = ‘gOOd moRning’
Command to convert ‘a’ from ‘gOOd moRning’ to ‘Good Morning’ is:-

[Link]( )

[Link]( )

[Link]( )

[Link]( )
Create a list called “Stationery” with the below data

Product = ['Pencil', 'Pen', 'Eraser', 'Pencil Box', 'Scale']


Price= [5, 10, 2, 20, 12]
Brand = ['Camlin', 'Rotomac', 'Nataraj', 'Camel', 'Apsara']
Stationery = [Product, Price, Brand]

The command to add “Notebook” as the first element inside the first level of the list “Stationery” is:-

Stationery[0].append('Notebook')

Stationery[0].insert(0,'Notebook')

Stationery[0][1] = "Notebook"

Stationery[0].extend('Notebook')

The method to clear all the elements from a Set is:-

remove( )

discard( )

clear( )

delete()
Consider the list,

Mylist =[‘a’, ‘a’, ‘b’, ‘b’, ‘b’, ‘c’, ‘c’, ‘d’, ‘e’]

The output of the code: [Link](‘d’) is

Week 3: Practice Assignment 3


Which of the following can be inferred from scatter plot of ‘mpg’ (Miles per gallon) vs ‘wt’ (Weight of
car) from the dataset [Link]?

As weight of the car increases, the mpg decreases

As weight of the car increases, the mpg increases

There is no relation between weight of the car and mpg

When weight increases, mpg increases exponentially


Plot a boxplot for “price” vs “cut” from the dataset “[Link]”. Which of the categories
under “cut” have the highest median price?

Good

Ver Good

Premium

Fair
In the [Link] dataframe, what are the total no. of missing values for the variable TotalCharges?

10

23

15

5
The command used for line plot from the package Matplotlib?

plot( )

line( )

join( )
plt( )
The probability of two different events occurring at the same time is known as

Marginal probability

Conditional probability

Joint probability

Marginal and Joint probability

Week 4: Practice Assignment 4


Which of the following functions can be used to split the data into train and test?

pandas.train_test_split( )

numpy.train_test_split( )

sklearn.model_selection.train_test_split( )

sklearn.train_test_split( )
The function used to perform k-Nearest Neighbors classification is: -

[Link]

[Link]

[Link]( )

[Link]( )
A Linear Regression model is said to be good when the R-squared value tends to

-1

0.5
The Gini coefficient ranges from

0 to 1

-1 to 0

-1 to 1

None of the above


What is hetero scedasticity as used to assess a Linear Regression model?
Linear regression with varying error terms

Linear regression with constant error terms

Linear regression with no error terms

All the above

You might also like