Question 15
Back to Exercise
What is the output of the following Python program?
print(int(" 42\n"), float(" 3.5 "), int("0x1f", 16), bool("0"), bool(int("0")))
- A 42 3.5 31 False False
- B ValueError
- C 42 3.5 1f True False
- D 42 3.5 31 True False Correct
Correct Answer: Option D
int and float ignore surrounding whitespace. "0" is a non-empty string (truthy); int("0") is 0 (falsy).
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!