Floor Division


#1

i need help understanding floor division. i tried using the site codecademy gives but i still can't understand.

all help is appreciated :smiley:

sorry if this is in the wrong section but i first found out about it in this section.


#2

By this section, do you mean "Practice Makes Perfect"? Which lesson?

In Python, division between two integers is a form of floor division since only the integer portion of the quotient is returned. That is the main purpose of floor division, to return the 'floor' value in any division.

10.5 / 3  == 3.5
10.5 // 3 == 3
9.0 / 3 == 3.0
9.0 // 3 == 3

Does that make sense?


#3

I found out about it in 'Practice Makes Perfect' in the Digit_sum lesson

thx for the help. i really appreciate it :smile: i now understand it


#4

Note that I corrected the third line in the example.


#5

Ah, yes. I can see where it would come in there. We have several approaches to choose from and using floor division is one of them that will work. I trust you've seen enough examples to pull it all together, so won't drag this out.