Challenge - 5 Problems
Jupyter Notebook Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2: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
Attempts:
2 left
💡 Hint
Remember that print outputs to the cell output, and the last expression's value is also shown.
✗ Incorrect
The print statement outputs 20 first. Then the last expression 'x' outputs 10 as the cell's result.
❓ data_output
intermediate2: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
Attempts:
2 left
💡 Hint
In Jupyter, returning a DataFrame displays it as a table.
✗ Incorrect
The DataFrame object is rendered as a table with columns and rows in Jupyter Notebook.
🧠 Conceptual
advanced2:00remaining
Kernel behavior in Jupyter Notebook
What happens when you restart the kernel in a Jupyter Notebook?
Attempts:
2 left
💡 Hint
Think about what a kernel controls in Jupyter Notebook.
✗ Incorrect
Restarting the kernel clears all memory including variables and imports. You need to rerun cells to restore the environment.
🔧 Debug
advanced2: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
Attempts:
2 left
💡 Hint
Variables must be defined before use in the same kernel session.
✗ Incorrect
Since b is assigned after the print statement, it is undefined when print(b) runs, causing a NameError.
🚀 Application
expert2: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)
Attempts:
2 left
💡 Hint
Single line timing uses %time, cell timing uses %%time.
✗ Incorrect
The %time magic times a single line of code. %%time is for timing whole cells. %timing and %%timing are invalid magics.