+ 29

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

45 ответов

+ 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

+ 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

+ 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)

+ 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.

+ 19

5//2=4/2=2; then 7%2=7-2*3=1

+ 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

+ 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

+ 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

+ 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

+ 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?

+ 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. . I