Computer Science, asked by daleisipranjali, 1 month ago

Consider following expression in Python- 125//20 + 25%2 Write the order in which operators will be executed. Also write the result of the expression.​

Answers

Answered by idyllic
0

floor division (//) and modulus (%) have the same priority and thus python will execute the command from the left side (from 125//20)

=> 125//20 =  6                  (because its floor division)

=> 6 + 25%2

here, "%" has more priority than addition (+) so it will do "25%2" first

25%2 = 1

=> 6 + 1

=> 7

hope this helps :)

Similar questions