+ 29

7%(5//2) =1. please explain. I don't understand how they get 1?

7th Dec 2015, 6:28 AM
Sean
46 Answers
+ 77
Floor division: How many 2s fits inside 5 ? = 2 Modulus/Remainder: How much space wasn't used when fitting the 2 inside 5 ? 1 space
6th Jan 2016, 7:03 PM
Luiz Vieira
Luiz Vieira - avatar
+ 64
how many times can 2 fit into 5(5//2)the answer is 2 times. so the equation is 7% (2), 2 fits into 7 three times with a remainder of 1. so the answer is 7% (5//2)=1
19th Feb 2016, 6:07 PM
Timothy Duke
Timothy Duke - avatar
+ 54
when 5is divided by 2 the quotient is 2 and when 7 is divided by quotient 2 remainder is 1 (//represent quotient and % represent remainder)
19th Feb 2016, 8:02 AM
kartikey
kartikey - avatar
+ 44
Step 1: Solve the parentheses (5//2) It will output 2, because we are doing floor division. Our output will be in Integer. By simple division (5/2), it will output 2.5, because it prints the value in float. So 5//2 = 2 Now we have 7%(2) Step 2: %(modulus) sign is used for remainder. when we divide 7 by 2, we have remainder 1. 7%2 = 1 So, It will print 1. Hence our answer will be 1.
18th Sep 2016, 1:52 PM
Shahid Islam
Shahid Islam - avatar
+ 19
5//2=4/2=2; then 7%2=7-2*3=1
30th Dec 2015, 5:35 AM
Shelton Wang
+ 10
it's actually asking what is left after fitting the 2 (from 5//2) inside 7, witch is always 1 with any odd number
28th Feb 2016, 12:43 AM
Bradley Patterson
Bradley Patterson - avatar
+ 10
In python3 // means result is integer. so 5//2 reault is 2. and then 7%2 means you want a remainder of 7/2. So finally get 1
9th Aug 2016, 6:20 AM
LukeOnRoad
+ 9
[img]http://i.imgur.com/kPcQsWb.png[/img] 7%(5//2)=1 Step 1: (5//2) = 2 (floored quotient) Step 2: 7%2 = 1 (remainder) Hence: 7%(5//2) = 1
18th Sep 2016, 4:27 PM
yancy
yancy - avatar
+ 7
first 5//2 means 5 how many 2 then 7%2 mean divide 7 until there is no 2 7/2=5/2=3/2=1
6th Jan 2016, 2:38 PM
onur
+ 7
I think I understand. so: 7%(5//2) -> 7%(2) -> we discard the remainder (.5) -> so: 7%2 = 3.5 -> we discard the remainder (.5) again. So: 3/2=1.5 -> discard remainder (.5) =1 Couldn't we also just multiply the remainder by 2 or would that not work uniformly?
2nd Apr 2016, 3:38 PM
octavio
+ 4
(5//2) = the answer is 2. Then 7 % 2, for this you need to find the remainder to get the 7. 7 = ... * 2 + remainder. 7 = 3 * 2 + remainder 7 = 6 + remainder, so 7 = 6 + 1 7= 7 You need make it to the closest number for the multiplication. . If u got 7= 1*2 + 5 this are wrong. Then if u do this: 7 = 4*2+? You cant get the 7.. So try the closest multiplication till you cant get the 7(number that you want to search the remainder) sorry for bad English. Hope this help you..
7th Jan 2016, 3:25 PM
Zakhayu Rian
Zakhayu Rian - avatar
+ 4
// mean u will get quotient % mean u will get remainder
26th Jun 2016, 4:11 AM
Om Ar
Om Ar - avatar
+ 4
5//2 = 2 7/2 = 6 r1 (We use the remainder)
1st Aug 2016, 12:48 AM
Computer_Overlord
Computer_Overlord - avatar
+ 3
In Python by default take float data type So any division calculations it will give us floating value Suppose that 24/12 = 2.0 not 2 But 24 // 12 = 2 not 2.0 Try to understand difference / - is division it will give floating value // - is floor division it will give integer value
18th Nov 2016, 6:15 PM
Ugra Narasimha
Ugra Narasimha - avatar
+ 2
Since 5//2 = 2 why 2 ? because we have to check how many times does 2 exactly makes 5 but we can't figure out so we take nearest that is 4 so 4 is two times 2 hence 5//2= 2 now 7%(5//2) = 7%2 = remainder when 7 gets divided by 2 so 7%2 =1
10th Jul 2016, 8:20 PM
RUDRABHA MUKHERJEE
RUDRABHA MUKHERJEE - avatar
+ 2
firstly it gives floor value 2 then 7 modules 2 gives remainder which is 1
22nd Sep 2016, 3:30 AM
Gaurav Agarwal
Gaurav Agarwal - avatar
+ 2
% operator means remeinder .. whereby 5÷2 =2 7%2 that is 7÷2=3 remeinder 1.. 😊
1st Dec 2016, 1:01 AM
JONH GITAU MKANGAI
JONH GITAU MKANGAI - avatar
+ 2
You know it's a good thread when people are still trying to answer this question more than 3 years later.
10th Mar 2019, 2:27 PM
Hatsy Rei
Hatsy Rei - avatar
+ 1
this is actually modular division which means that if u divide 7 by 5/2 the remainder is 1
7th Oct 2016, 3:25 PM
Ishita Arora
Ishita Arora - avatar
+ 1
its very simple here 5//2 will return an integer because 5/2 returns a float result, but 5//2 will return a int result which is 2 , and hence 2%7 gives modulous as 1
23rd Oct 2016, 3:17 PM
Mukul Ahlawat
Mukul Ahlawat - avatar