Actually, in Python, both multiplication (*) and floor division (//) have the same precedence level, and they are evaluated from left to right.
So, in the given code print(1 // 2 * 3):
1 // 2 is evaluated first, resulting in 0 because 1 divided by 2 is 0.5 and the floor division of 0.5 is 0.
Then, 0 * 3 is evaluated, which is 0.
Therefore, the expected output is indeed 0.
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
akumo
1 month agohovnival
3 months, 3 weeks ago