+ 1
7%(5//2) explain me this
5 odpowiedzi
+ 9
Hey there 😃
7 % (5 // 2) takes the remainder of 7 divided by the floor of 5 // 2.
5 // 2
= 5 / 2 = 2.5
= floor 2.5 = 2
Then 7 % 2:
7 / 2 = 6 with a remainder of 1. This is because 2 can not go into 7, but it can go into 6. 7 - 6 = 1, where 1 is the remainder.
7 % 2 = 1
Hope it helps!
+ 7
7℅(5//2)
First we solve parenthesis so,
5//2=2
Now,
7%2=1
Answer is 👉 1
+ 3
Avinash Avi // is integer division in python
+ 2
[EDITED] IN TERMS OF C++
The code will return an error.
Everything after this symbol // is ignored as a comment. So the code will try to calculate 7% (5 but can't calculate because a closing paranthesis is missing. The last paranthesis you have used will be considered as a comment and ignored.
+ 2
Well, he didn't mentioned it so I explained it in terms of c++ concepts. Thank you for the clarification Anna.