0
0
SciPydata~20 mins

Mathematical constants (pi, e, golden ratio) in SciPy - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Master of Mathematical Constants
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
1:00remaining
Output of pi constant from scipy
What is the output of this code snippet that prints the value of pi from scipy.constants?
SciPy
from scipy.constants import pi
print(round(pi, 4))
A3.1416
B3.14
C3.142
D3.1415
Attempts:
2 left
💡 Hint
Use round() to 4 decimal places on pi constant.
data_output
intermediate
1:00remaining
Value of Euler's number (e) from numpy
What is the value of Euler's number (e) from numpy when rounded to 3 decimals?
SciPy
from numpy import e
print(round(e, 3))
A2.719
B2.718
C2.717
D3.142
Attempts:
2 left
💡 Hint
Euler's number e is about 2.71828.
🧠 Conceptual
advanced
1:30remaining
Understanding the golden ratio constant
Which of the following statements about the golden ratio constant from scipy.constants is true?
AIt is the same as pi but used in geometry.
BIt is exactly 1.5 and used mainly in computer science algorithms.
CIt is a variable constant that changes with time.
DIt is approximately 1.618 and represents a special ratio in nature and art.
Attempts:
2 left
💡 Hint
Think about the unique properties of the golden ratio.
Predict Output
advanced
1:30remaining
Calculate the sum of pi, e, and golden ratio constants
What is the output of this code that sums pi and golden from scipy.constants and e from numpy and rounds to 5 decimals?
SciPy
from scipy.constants import pi, golden
from numpy import e
result = pi + e + golden
print(round(result, 5))
A7.47790
B7.47793
C7.47791
D7.47792
Attempts:
2 left
💡 Hint
Add the three constants and round the sum to 5 decimals.
🔧 Debug
expert
2:00remaining
Identify the error in accessing the golden ratio constant
What error will this code raise when trying to import and print the golden ratio constant from scipy.constants?
SciPy
from scipy.constants import golden_ratio
print(golden_ratio)
AImportError
BModuleNotFoundError
CAttributeError
DNameError
Attempts:
2 left
💡 Hint
Check the exact name of the golden ratio constant in scipy.constants.