I can't figure out what does this symbol mean in python (%) ps: English isn't my native language so I don't understand it a lot. | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

I can't figure out what does this symbol mean in python (%) ps: English isn't my native language so I don't understand it a lot.

Thanks

26th Jun 2020, 1:17 PM
Abdennour Rida
Abdennour Rida - avatar
7 ответов
+ 4
So 9 divided by 3 = 3. There's 3 3's in 9. Remainder is a number that's left over, not using decimals. So 9 divided by 9 has no remainder because it 3 fits into 9 3 times with no leftover. The % in python shows you just the remainder so in this scenario it would return 0. If you did it with a number that didn't fit like 10 % 3, 3 fits into 10 3 times with 1 leftover. The remainder is 1 so this is what 10%3 would return, 1.
26th Jun 2020, 1:25 PM
Olivia
Olivia - avatar
+ 2
You use it to find the remainder of a division. 9%3=0 10%3=1
26th Jun 2020, 1:18 PM
Olivia
Olivia - avatar
+ 2
Exactly! Never be afraid to ask for help 😃
26th Jun 2020, 1:28 PM
Olivia
Olivia - avatar
+ 1
%its a modulo operator
27th Jun 2020, 11:46 PM
Clinton Ufere
Clinton Ufere - avatar
0
I still don't understand i am just 14 and i still haven't learned that in school but thanks for the quick reply
26th Jun 2020, 1:20 PM
Abdennour Rida
Abdennour Rida - avatar
0
Ohhh thanks so much i finally get it like 16%5 that means there is 1 as a leftover thank you both Olivia an Kiibo
26th Jun 2020, 1:27 PM
Abdennour Rida
Abdennour Rida - avatar
26th Jun 2020, 1:31 PM
Abdennour Rida
Abdennour Rida - avatar