0
0
Data Analysis Pythondata~20 mins

Jupyter Notebook setup and usage 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
2:00remaining
Output of a Jupyter Notebook cell with variable assignment and print
What is the output shown in the notebook cell after running this code?
Data Analysis Python
x = 10
print(x * 2)
x
A
10
20
B
20
10
C
20
20
D
10
10
Attempts:
2 left
💡 Hint
Remember that print outputs to the cell output, and the last expression's value is also shown.
data_output
intermediate
2:00remaining
DataFrame display in Jupyter Notebook
What will be the displayed output of this Jupyter Notebook cell?
Data Analysis Python
import pandas as pd
df = pd.DataFrame({'A': [1, 2], 'B': [3, 4]})
df
AA table with columns A and B, rows 0 and 1, values [[1,3],[2,4]]
B{'A': [1, 2], 'B': [3, 4]}
CA list of tuples: [(1,3), (2,4)]
DA printed string: ' A B\n0 1 3\n1 2 4'
Attempts:
2 left
💡 Hint
In Jupyter, returning a DataFrame displays it as a table.
🧠 Conceptual
advanced
2:00remaining
Kernel behavior in Jupyter Notebook
What happens when you restart the kernel in a Jupyter Notebook?
AThe notebook saves automatically and continues running without interruption.
BOnly variables are cleared; imports remain available.
CThe notebook interface closes and reopens automatically.
DAll variables and imports are cleared; you must rerun cells to restore state.
Attempts:
2 left
💡 Hint
Think about what a kernel controls in Jupyter Notebook.
🔧 Debug
advanced
2:00remaining
Identify the error in Jupyter Notebook cell execution order
You run these cells in order: Cell 1: a = 5; Cell 2: print(b); Cell 3: b = 10 What error occurs and why?
Data Analysis Python
Cell 1:
a = 5

Cell 2:
print(b)

Cell 3:
b = 10
ASyntaxError in Cell 2 due to missing variable declaration.
BNo error; output is 10.
CNameError in Cell 2 because b is not defined before print.
DTypeError in Cell 2 because b is not an integer.
Attempts:
2 left
💡 Hint
Variables must be defined before use in the same kernel session.
🚀 Application
expert
2:00remaining
Using magic commands to time code execution in Jupyter Notebook
Which option correctly uses a Jupyter magic command to time how long a single line of code takes to run?
Data Analysis Python
import time

# Code to time: time.sleep(1)
A%time time.sleep(1)
B%%time time.sleep(1)
C%timing time.sleep(1)
D%%timing time.sleep(1)
Attempts:
2 left
💡 Hint
Single line timing uses %time, cell timing uses %%time.