The following code:
print(float("1, 3"))
- prints 1.3
- prints 13
- prints 1,3
- raises a ValueError exception
Explanation: The float function tries to convert the 1, 3 string into a floating-point value. Since it contains a comma and a whitespace, a ValueError exception is raised because it cannot be converted.
More Questions: Python Essentials 2 – Module 2 Test
Please login or Register to submit your answer