0
0
SciPydata~10 mins

Why SciPy exists - 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'
Apandas
Bmatplotlib
Cscipy
Dnumpy
Attempts:
3 left
💡 Hint
Common Mistakes
Importing numpy instead of scipy
Importing pandas or matplotlib which are for data and plotting
2fill in blank
medium

Complete the code to use SciPy's function to calculate the integral of a function.

SciPy
from scipy import integrate
result = integrate.[1](lambda x: x**2, 0, 1)
Drag options to blanks, or click blank then click option'
Aderivative
Bquad
Coptimize
Dfft
Attempts:
3 left
💡 Hint
Common Mistakes
Using derivative which calculates derivatives, not integrals
Using optimize or fft which are unrelated here
3fill in blank
hard

Fix the error in the code to import the linear algebra module from SciPy.

SciPy
from scipy import [1]
result = [1].inv([[1, 2], [3, 4]])
Drag options to blanks, or click blank then click option'
Asignal
Bstats
Coptimize
Dlinalg
Attempts:
3 left
💡 Hint
Common Mistakes
Importing stats or optimize which do not have matrix inversion
Using signal which is for signal processing
4fill in blank
hard

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

SciPy
{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('a')
Dword.upper()
Attempts:
3 left
💡 Hint
Common Mistakes
Using word.upper() as value which changes the word
Using word.startswith('a') as condition which filters differently
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps uppercase words to their lengths if length is greater than 4.

SciPy
{ [1]: [2] for word in words if [3] }
Drag options to blanks, or click blank then click option'
Aword.upper()
Blen(word)
Clen(word) > 4
Dword.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using word.lower() as keys which is lowercase
Using length condition less than or equal to 4