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

I can't understand what is 7%(5//2)

16th Oct 2021, 8:58 AM
fighter champ
2 Answers
+ 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
16th Oct 2021, 9:17 AM
Devnull
Devnull - avatar
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
16th Oct 2021, 9:33 PM
Jasy Fabiano
Jasy Fabiano - avatar