How to use division in python

The use of division (/, //, %) in python


1) Use of /

print(10 / 3)  # 3.3333333333

It's very simple, just a normal division operation

2) Use of //

print(10 // 3)  # 3

// The usage is to round down 10 // 3 = 3.3333, round down the integer, take 3

3) Use of %

print(10 % 3)  # 1

Take the remainder, 10 % 3 = 3...1, remainder 1, take the remainder 1

Guess you like

Origin blog.csdn.net/AI_dataloads/article/details/134342457