0
0
Data Analysis Pythondata~10 mins

Why efficiency matters with large datasets in Data Analysis Python - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a list of squares for numbers 1 to 5.

Data Analysis Python
squares = [x[1]2 for x in range(1, 6)]
print(squares)
Drag options to blanks, or click blank then click option'
A//
B+
C*
D**
Attempts:
3 left
💡 Hint
Common Mistakes
Using multiplication (*) instead of exponentiation (**)
Using addition (+) which adds numbers instead of squaring
2fill in blank
medium

Complete the code to filter numbers greater than 10 from the list.

Data Analysis Python
numbers = [5, 12, 7, 18, 3]
filtered = [n for n in numbers if n [1] 10]
print(filtered)
Drag options to blanks, or click blank then click option'
A<
B>
C==
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using less than (<) which selects smaller numbers
Using equality (==) which selects only numbers equal to 10
3fill in blank
hard

Fix the error in the code to calculate the average of a list.

Data Analysis Python
data = [10, 20, 30]
avg = sum(data) [1] len(data)
print(avg)
Drag options to blanks, or click blank then click option'
A/
B-
C+
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using addition (+) or multiplication (*) instead of division
Using subtraction (-) which is incorrect here
4fill in blank
hard

Fill both blanks to create a dictionary of word lengths for words longer than 3 letters.

Data Analysis Python
words = ['data', 'is', 'fun', 'and', 'big']
lengths = {word: [1] for word in words if len(word) [2] 3}
print(lengths)
Drag options to blanks, or click blank then click option'
Alen(word)
Bword
C>
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using the word itself as the value instead of its length
Using < instead of > which selects shorter words
5fill in blank
hard

Fill all three blanks to create a dictionary with uppercase keys and values greater than 0.

Data Analysis Python
data = {'a': 1, 'b': -2, 'c': 3}
result = { [1]: [2] for k, v in data.items() if v [3] 0 }
print(result)
Drag options to blanks, or click blank then click option'
Ak.upper()
Bv
C>
Dk
Attempts:
3 left
💡 Hint
Common Mistakes
Using original keys instead of uppercase
Filtering values less than or equal to zero
Swapping keys and values in the dictionary