Why Do We Use Floor Division Here?


#1

I understand that getting the remainder of a number divided by 10 only leaves you with the ones digit (right most number) but why do we have to floor divide the x by 10 after (x // 10)?


FAQ: Learn Python - Practice Makes Perfect - digit_sum
#2

Same question. What is the purpose for flooring divide the x by 10 (X // 10)?


#3

lets say we have 234, we first get the 4 using the modulo operator, but then we have used the 4, now we need to access the 3. How do we do this? By removing the 4 using floor division, this way, 3 becomes the right most digit, and we can access the 3 using the modulo operator


#4

Thank you so much for your help!