Python basics
Pandas
Matplotlib & seaborn
Python snippets
100

2

print(7 % 3)



100

import pandas as pd

Which command loads Pandas?
A. import pandas as pd
B. import panda as pd
C. import pd
D. from pandas import *

100

plt.show()

Which command displays the plot?
A. plt.open()
B. plt.display()
C. plt.show()
D. plt.start()

100

11

What is the output of: 

 x = 5; print(x * 2 + 1)

200

False

print(10 > 5 and 2 > 3)


200

df.tail(3)

Which command shows the last 3 rows of a DataFrame?

A. df.tail(3)
B. df.start(3)
C. df.head(3)
D. df.first(3)  

200

plt.plot()

Which command creates a basic line plot?
A. plt.line()
B. plt.plot()
C. plt.graph()
D. plt.map()

200

True

print(4 == 4)

300

7

What is the output? 

x = 5

x + = 2

print(x)


300

 df["Age"]

How do you select a single column named “Age”?

A. df(Age)
B. df.[Age]
C. df["Age"]
D. Both B and C  

300

sns.heatmap()

You want to see which columns in your dataset have higher or lower correlation with each other using colors. Which Seaborn function helps you do this?

A. sns.barplot()
B. sns.heatmap()
C. sns.boxplot()
D. sns.scatterplot()

300

Hello Alex

What is the output of 

name = "Alex"; 

print("Hello ", name)

400

3 2 1

x = 3

while x > 0:

    print(x)

    x -= 1


A. 3
B. 3 2 1
C. 1 2 3
D. Infinite loop 

400

pd.read_excel()

Which function reads an Excel file? 

A. pd.read_excel()
B. pd.import_excel()
C. pd.read_xlsx()
D. pd.open_excel()

400

Add a title

What is the purpose of plt.title("Graph Title")?
A. Add color
B. Add a title
C. Add a caption
D. Resize the plot

400

contract law

What is the output of the string method: 

case = "Contract Law"; 

print(case.lower())

500

Hi Hi

for i in range(2):

 print("Hi")


A. Hi
B. Hi Hi
C. Nothing
D. Error 

500

df.shape

Which command shows the number of rows and columns in a DataFrame?

A. df.size
B. df.shape
C. df.count()
D. df.length()

500

import matplotlib.pyplot as plt

plt.bar(x, y)

plt.scatter(x, y)

plt.show()


You have two lists in Python:

x = [1, 2, 3, 4] y = [10, 20, 15, 25]


Which Matplotlib command will create:

a) A bar chart of x vs y?
b) A scatter plot of x vs y?

500

45

sum_val = 0

for i in range(10):

    sum_val = sum_val + i

print(sum_val)

M
e
n
u