0
0
SciPydata~10 mins

Why advanced methods solve complex problems in SciPy - 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
Bpandas
Cmatplotlib
Dnumpy
Attempts:
3 left
💡 Hint
Common Mistakes
Importing numpy instead of scipy
Importing pandas which is for data frames
Importing matplotlib which is for plotting
2fill in blank
medium

Complete the code to use the root finding function from SciPy.

SciPy
from scipy.optimize import [1]
Drag options to blanks, or click blank then click option'
Acurve_fit
Bminimize
Croot
Dlinprog
Attempts:
3 left
💡 Hint
Common Mistakes
Using minimize which is for optimization
Using curve_fit which is for fitting curves
Using linprog which is for linear programming
3fill in blank
hard

Fix the error in the function call to find the root of f(x) = x^2 - 4.

SciPy
result = root(lambda x: x[1]2 - 4, 1.0)
Drag options to blanks, or click blank then click option'
A**
B+
C*
D-
Attempts:
3 left
💡 Hint
Common Mistakes
Using * which means multiplication
Using + which adds numbers
Using - which subtracts numbers
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps numbers to their square roots if the number is positive.

SciPy
roots = {x: x[1]0.5 for x in range(-2, 3) if x [2] 0}
Drag options to blanks, or click blank then click option'
A**
B>
C<
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using '*' instead of '**' for power
Using '<' instead of '>' for positive check
5fill in blank
hard

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

SciPy
lengths = {word: len(word) [1] 3 for word in words if len(word) [2] 3}
Drag options to blanks, or click blank then click option'
B>
D.upper()
Attempts:
3 left
💡 Hint
Common Mistakes
Putting extra characters in the first blank
Using '<' instead of '>' for length comparison