+ 2

In / and % which of the two is higher in precedence because they usually get interchanged

31st Oct 2020, 4:29 PM
PythÞñ CĂșltĂźstâš”ïžđŸ”„đŸ‡łđŸ‡Ź
PythÞñ  CĂșltĂźstâš”ïžđŸ”„đŸ‡łđŸ‡Ź - avatar
5 Answers
+ 4
Seb TheS Yes u were right . * , / , % has same precedence and just gets evaluated from left to right..👍
1st Nov 2020, 4:37 AM
Alphin K Sajan
Alphin K Sajan - avatar
+ 2
Eskay👑👑 you should say which language you mean. In Python the are evaluated from left to right by definition. Right to left (or defining different precedence levels) would change the result obviously, but that's not how it works
31st Oct 2020, 5:41 PM
Benjamin JĂŒrgens
Benjamin JĂŒrgens - avatar
+ 2
Alphin K Sajan If / has higher precedence than %, then 10 % 8 / 2 should evaluate to 10 % 4.0 causing result 2.0. But 10 % 8 / 2 gives result 1.0.
31st Oct 2020, 9:40 PM
Seb TheS
Seb TheS - avatar
+ 1
What about solving the expression from right to left, won't it change
31st Oct 2020, 4:35 PM
PythÞñ CĂșltĂźstâš”ïžđŸ”„đŸ‡łđŸ‡Ź
PythÞñ  CĂșltĂźstâš”ïžđŸ”„đŸ‡łđŸ‡Ź - avatar