0
0
SciPydata~10 mins

Mathematical constants (pi, e, golden ratio) in SciPy - Interactive Code Practice

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

Complete the code to import the constant pi from scipy.

SciPy
from scipy.constants import [1]
print(pi)
Drag options to blanks, or click blank then click option'
Agolden
Bpi
Ce
Dtau
Attempts:
3 left
💡 Hint
Common Mistakes
Importing 'e' instead of 'pi'.
Using 'golden' which is the golden ratio, not pi.
2fill in blank
medium

Complete the code to print the value of the mathematical constant e from scipy.

SciPy
from scipy.constants import [1]
print(e)
Drag options to blanks, or click blank then click option'
Api
Bphi
Cgolden
De
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing 'pi' with 'e'.
Using 'golden' which is the golden ratio, not e.
3fill in blank
hard

Fix the error in the code to correctly import and print the golden ratio constant from scipy.

SciPy
from scipy.constants import [1]
print(golden)
Drag options to blanks, or click blank then click option'
Agolden_ratio_value
Bphi
Cgolden
Dgolden_ratio
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'golden_ratio' which is not defined in scipy.constants.
Trying to import 'phi' which is not the correct name.
4fill in blank
hard

Fill both blanks to create a dictionary with keys 'pi' and 'e' and their values from scipy.constants.

SciPy
constants = {'pi': [1], 'e': [2]
print(constants)
Drag options to blanks, or click blank then click option'
Api
Be
C3.14
D2.71
Attempts:
3 left
💡 Hint
Common Mistakes
Using approximate float values instead of constants.
Mixing up keys and values.
5fill in blank
hard

Fill all three blanks to create a dictionary with keys 'pi', 'e', and 'golden' and their values from scipy.constants.

SciPy
constants = {'pi': [1], 'e': [2], 'golden': [3]
print(constants)
Drag options to blanks, or click blank then click option'
Api
Be
Cgolden
Dphi
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'phi' instead of 'golden'.
Using approximate numbers instead of constants.