QuestionQ28

VerifiedControl Flow – Conditional Blocks and Loops

What output does the following code produce?

x = 4.5  
y = 2  
print(x // y)  
Explanation

Python’s // operator applies floor division. 4.5 / 2 is 2.25, whose floor is 2; because the operation involves a float, the result is a float, so it prints as 2.0.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!