Complete the code to import the SciPy library.
import [1]
We import scipy to use its advanced scientific computing functions.
Complete the code to use the root finding function from SciPy.
from scipy.optimize import [1]
The root function is used to find roots of equations, which is an advanced method to solve complex problems.
Fix the error in the function call to find the root of f(x) = x^2 - 4.
result = root(lambda x: x[1]2 - 4, 1.0)
The operator ** is used for exponentiation in Python, so x**2 means x squared.
Fill both blanks to create a dictionary comprehension that maps numbers to their square roots if the number is positive.
roots = {x: x[1]0.5 for x in range(-2, 3) if x [2] 0}We use ** to calculate the square root (power 0.5) and > to check if the number is positive.
Fill both blanks to create a dictionary comprehension that maps words to True only if their length is greater than 3.
lengths = {word: len(word) [1] 3 for word in words if len(word) [2] 3}The first blank is empty because the syntax is {key: value}. The second and third blanks use '>' to check if length is greater than 3.