Challenge - 5 Problems
Essential Libraries Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this NumPy array operation?
Consider the following code that uses NumPy to create and manipulate arrays. What will be printed?
Data Analysis Python
import numpy as np arr = np.array([1, 2, 3, 4]) result = arr * 2 + 1 print(result)
Attempts:
2 left
💡 Hint
Remember that NumPy applies operations element-wise on arrays.
✗ Incorrect
Each element in the array is multiplied by 2, then 1 is added. So 1*2+1=3, 2*2+1=5, etc.
❓ data_output
intermediate2:00remaining
What does this Pandas DataFrame look like after filtering?
Given this DataFrame, what rows remain after filtering for values greater than 50 in column 'B'?
Data Analysis Python
import pandas as pd df = pd.DataFrame({'A': [10, 20, 30, 40], 'B': [45, 55, 65, 35]}) filtered_df = df[df['B'] > 50] print(filtered_df)
Attempts:
2 left
💡 Hint
Look for rows where column 'B' has values strictly greater than 50.
✗ Incorrect
Only rows with 'B' values 55 and 65 meet the condition, which are rows with index 1 and 2.
❓ visualization
advanced2:00remaining
What kind of plot does this Matplotlib code produce?
Look at this Matplotlib code. What type of plot will it create?
Data Analysis Python
import matplotlib.pyplot as plt x = [1, 2, 3, 4] y = [10, 20, 25, 30] plt.bar(x, y) plt.show()
Attempts:
2 left
💡 Hint
The function plt.bar creates vertical bars.
✗ Incorrect
plt.bar creates a bar chart with bars at the x positions with heights from y.
🧠 Conceptual
advanced1:30remaining
Which library is best suited for fast numerical operations on arrays?
You want to perform fast mathematical operations on large arrays of numbers. Which library is designed specifically for this?
Attempts:
2 left
💡 Hint
Think about which library provides efficient array objects and math functions.
✗ Incorrect
NumPy provides fast array structures and mathematical functions optimized for numerical data.
🔧 Debug
expert2:00remaining
What error does this Pandas code raise?
This code tries to select a column from a DataFrame but causes an error. What error is raised?
Data Analysis Python
import pandas as pd df = pd.DataFrame({'X': [1, 2], 'Y': [3, 4]}) print(df['Z'])
Attempts:
2 left
💡 Hint
The column 'Z' does not exist in the DataFrame.
✗ Incorrect
Accessing a non-existent column in a DataFrame raises a KeyError.