+ 1
I can't understand what is 7%(5//2)
2 Réponses
+ 2
Hey, I will be happy to break it down for you
5 // 2 = 2
It's 2 since // rounds the number. It cannot round it to 3 since 2*3 is 6, so it rounds it to 2.
Then you have the modulo operator:
7 % 2 = 1
Basically:
7 - 2 = 5
5 - 2 = 3
3 - 2 = 1
Since 1 cannot be divided by 2 without becoming a float number, 1 is the reminder.
Modulo - modulo operation returns the remainder or signed remainder of a division, after one number is divided by another.
You can check the site below for better explanation and examples:
https://www.computerhope.com/jargon/m/modulo.htm
0
#just follow a bodmas rule
7%(5//2) ---> bracket comes first
5//2=2 // is used to get a quotient
7%2=1 % is used to get a remainder
The aswer is 1