Certified Entry-Level Python Programmer (PCEP-30-02) — Question 38

The following code:
print(float("1, 3"))

Answer options

Correct answer: D

Explanation

The correct answer is D because the float() function cannot convert a string with a comma into a float, leading to a ValueError. Options A, B, and C are incorrect as they suggest valid outputs that would not occur with the given input.