how 7%(5//2) is 1 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how 7%(5//2) is 1

15th Oct 2017, 9:04 PM
Sofya
Sofya  - avatar
7 Answers
+ 7
5 // 2 are in brackets, so evaluate that first. 5 // 2 = 5 divided by 2, rounded down. 5 / 2 = 2.5, rounded down = 2 7 % 2 = what are you left with when you divide 7 by 2? ( remainder ) 7 // 2 = 3 ( rounded down ) 2 * 3 = 6 ( 2 fits 3 times in 7 ) 7 - 6 = 1 ( left with 1 ) So that's why it is 1
15th Oct 2017, 9:18 PM
Dennis
Dennis - avatar
+ 1
Thank you
16th Oct 2017, 12:19 AM
Sofya
Sofya  - avatar
0
Where did you get 6 from
20th Oct 2017, 8:00 PM
Josiah Clymer
Josiah Clymer - avatar
0
Never mind👍
20th Oct 2017, 8:01 PM
Josiah Clymer
Josiah Clymer - avatar
0
Why 7-6?
20th Oct 2017, 8:02 PM
Josiah Clymer
Josiah Clymer - avatar
0
@Josiah Clymer In order to find the remainder you subtract the number by the biggest number that can possible fit inside it. In this case we subtract 6 from 7, because 6 is the biggest possible number that can divide 2 while staying below or equal to 7.
20th Oct 2017, 8:10 PM
Dennis
Dennis - avatar
0
I get it thank u
20th Oct 2017, 11:16 PM
Sofya
Sofya  - avatar