Question 8
Back to Exercise
What is the output of the following Python program?
print(type(10 / 2).__name__, 10 / 2, type(10 // 2).__name__, 10 // 2)
- A int 5 int 5
- B float 5.0 int 5 Correct
- C float 5.0 float 5.0
- D int 5.0 int 5
Correct Answer: Option B
True division (/) always returns a float, even when the result is whole. Floor division of two ints returns an int.
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!