What is the output of this code in Python Language: >>> x = 125 >>> y = 13 >>>…
2021
What is the output of this code in Python Language: >>> x = 125 >>> y = 13 >>> x //= y >>> x
- A.
9
- B.
125/13
- C.
10
- D.
9.62
Attempted by 1869 students.
Show answer & explanation
Correct answer: A
Step 1: The operator //= performs floor division, which divides the left operand by the right operand and returns the largest integer less than or equal to the result.
Step 2: Here, x = 125 and y = 13. The expression x //= y is equivalent to x = x // y.
Step 3: 125 divided by 13 is approximately 9.615. The floor of this value is 9, since it is the largest integer less than or equal to 9.615.
Step 4: Therefore, after the operation, x is assigned the value 9.