This example describes the use of true and floor division in Python3. Share to everyone for your reference, as follows:
In Python3, there are two kinds of division operations, one is true, the other is floor division, and the two are separate, as shown in the code:
>>>10/42.5>>>10//42>>>10/4.02.5>>>10//4.02.0
The division of a slash in Python3 is true except that it is the same as other programming languages, preserving floating-point numbers, and floor division is a division that removes floating-point numbers to preserve integers, so called floor division.
As an example, when to use floor division.
Xsize, ysize = avatar.sizefontsize = Min (xsize, ysize)//11myFont = Imagefont.truetype ("/library/fonts/osakamono.ttf", F Ontsize)
Here Xsize and ysize represent the width and height of the image, FontSize must pass in an integer for the font size, so the floor here is divided by 11 for integers, and from this code it can be seen that fontsize is an integer that is smaller by 11 of the width of high school.