0
0
Data Analysis Pythondata~20 mins

Jupyter Notebook best practices in Data Analysis Python - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Jupyter Notebook Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
1:30remaining
Output of cell execution order in Jupyter Notebook
Consider this sequence of Jupyter Notebook cells executed in order. What is the output of the last cell?
Data Analysis Python
a = 5
b = 10

# Cell 1
c = a + b

# Cell 2
c = c * 2

# Cell 3
print(c)
A20
B15
CSyntaxError
D30
Attempts:
2 left
💡 Hint
Remember that variables keep their values across cells unless redefined.
🧠 Conceptual
intermediate
1:00remaining
Best practice for notebook cell length
Which of the following is the best practice regarding the length of cells in a Jupyter Notebook?
AKeep cells short and focused on a single task or idea.
BWrite very long cells to avoid too many cells in the notebook.
CCombine all code into one cell for faster execution.
DUse cells only for markdown and write all code in external scripts.
Attempts:
2 left
💡 Hint
Think about readability and debugging ease.
🔧 Debug
advanced
1:30remaining
Identify the error in this notebook cell
What error will this Jupyter Notebook cell produce when run?
Data Analysis Python
import pandas as pd

df = pd.DataFrame({'A': [1, 2], 'B': [3, 4]})

print(df['C'])
ANameError
BTypeError
CKeyError
DNo error, prints empty column
Attempts:
2 left
💡 Hint
Check if the column 'C' exists in the DataFrame.
🚀 Application
advanced
1:30remaining
Improving notebook reproducibility
Which practice below best improves reproducibility of a Jupyter Notebook?
AUse random seeds only in some cells.
BInclude all data loading and preprocessing steps in the notebook.
CAvoid comments to keep the notebook clean.
DRun cells in any order to save time.
Attempts:
2 left
💡 Hint
Think about what someone else needs to run your notebook and get the same results.
visualization
expert
2:00remaining
Effect of inline plotting in Jupyter Notebook
What is the effect of running `%matplotlib inline` in a Jupyter Notebook?
APlots are displayed directly below the code cells as static images.
BPlots open in a new external window.
CPlots are saved automatically to disk.
DPlots are not displayed until the notebook is exported.
Attempts:
2 left
💡 Hint
Consider how plots appear inside the notebook interface.