0

Help the newcomer, I do not understand why such an answer?

Why, with the usual division of 10/3 with the residue, Python displays the response 3.33333, and when dividing 10% 3, the answer is 1? What exactly is considered? After all, the residue is 33333 ???? Explain to a stupid girl print (10/3) 3.33333335 print(10%3) 1

29th May 2022, 10:20 AM
Анна Осипова
4 Respuestas
+ 6
% is the modulus operator. It returns the remainder of a division. 10//3 (division with integer) gives you 3 3 * 3 = 9 -> remainder = 10 - 9 = 1
29th May 2022, 10:36 AM
Denise Roßberg
Denise Roßberg - avatar
+ 3
By this '/' division is done. And by this '%' the remainder is found. First one is division. Second one is modulus. 10/3 = 3.3333.. 10%3 = __________ 3 ) 10 ( 3.33.. - 9 ⬆Not this ______ 1 ⬅This is the answer _______ https://www.sololearn.com/post/1548908/?ref=app
29th May 2022, 1:46 PM
Aurora Borealis
Aurora Borealis - avatar
0
'/' возвращяет частное от двух чисел, то есть просто делит их '%' возвращает остаток от деления, то есть 15 % 6 == 3, потому что 6 в 15 может поместиться только 2, это будет 12, чтобы найти остаток 15 - 12 == 3
29th May 2022, 2:03 PM
TriXioN
TriXioN - avatar