Bird
0
0

What is the output of the following code?

medium📝 Predict Output Q13 of 15
Python - Operators and Expression Evaluation
What is the output of the following code?
result = 17 // 4
print(result)
A4.25
B4
C1
DError
Step-by-Step Solution
Solution:
  1. Step 1: Understand floor division operator //

    The operator // divides and returns the largest whole number less than or equal to the result.
  2. Step 2: Calculate 17 // 4

    17 divided by 4 is 4.25, floor division drops the decimal part, so result is 4.
  3. Final Answer:

    4 -> Option B
  4. Quick Check:

    17 // 4 = 4 [OK]
Quick Trick: Floor division drops decimals, so 17//4 is 4 [OK]
Common Mistakes:
MISTAKES
  • Confusing // with / which gives float
  • Expecting 4.25 instead of 4
  • Thinking // rounds up

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes