0
0
SciPydata~10 mins

Why SciPy connects to broader tools - Test Your Understanding

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

Complete the code to import the SciPy library.

SciPy
import [1]
Drag options to blanks, or click blank then click option'
Ascipy
Bnumpy
Cpandas
Dmatplotlib
Attempts:
3 left
💡 Hint
Common Mistakes
Importing numpy instead of scipy
Importing pandas or matplotlib which are different libraries
2fill in blank
medium

Complete the code to use SciPy's integration function.

SciPy
from scipy import [1]
Drag options to blanks, or click blank then click option'
Aoptimize
Bintegrate
Cstats
Dcluster
Attempts:
3 left
💡 Hint
Common Mistakes
Using optimize instead of integrate
Using stats or cluster which serve different purposes
3fill in blank
hard

Fix the error in the code to calculate the integral of sin(x) from 0 to pi.

SciPy
import numpy as np
from scipy import integrate
result, error = integrate.quad(np.[1], 0, np.pi)
print(result)
Drag options to blanks, or click blank then click option'
Asin
Bcos
Ctan
Dlog
Attempts:
3 left
💡 Hint
Common Mistakes
Using cosine or tangent instead of sine
Using logarithm which is unrelated here
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps words to their lengths if length is greater than 3.

SciPy
words = ['data', 'science', 'is', 'fun']
lengths = {word: [1] for word in words if [2]
Drag options to blanks, or click blank then click option'
Alen(word)
Blen(word) > 3
Cword.startswith('s')
Dword.isalpha()
Attempts:
3 left
💡 Hint
Common Mistakes
Using word itself instead of its length
Using unrelated conditions like startswith or isalpha
5fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps uppercase words to their lengths if length is greater than 2.

SciPy
words = ['AI', 'ML', 'DATA', 'SCIENCE']
result = {word.[1](): [2] for word in words if len(word) > 2}
Drag options to blanks, or click blank then click option'
A{
Bupper
Clen(word)
D[
Attempts:
3 left
💡 Hint
Common Mistakes
Using list brackets instead of dictionary braces
Using lowercase method instead of upper
Using word instead of its length for values