What will be the output of the following Python expression? [code]24//6%3, 24//4//2[/code]

Phạm Quyết

New member
What will be the output of the following Python expression?
Code:
24//6%3, 24//4//2
A. (1,3)
B. (0,3)
C. (1,0)
D. (3,1)
 
Answer: a
Explanation: The expressions are evaluated as: 4%3 and 6//2 respectively. This results in the answer (1,3). This is because the associativity of both of the expressions shown above is left to right.
 

Tìm kiếm

Back
Top