--Verwenden Sie `` `divmod```
n = 3
cnt = 10
quot, mod = divmod(cnt, n)
#Quotient
print(quot)
#Überschuss
print(mod)
>>> #Quotient
>>>
>>> print(quot)
3
>>> #Überschuss
>>>
>>> print(mod)
1
>>>
//
``%`
n = 3
cnt = 10
#Quotient
print(cnt // n)
#Überschuss
print(cnt % n)
>>> #Quotient
>>>
>>> print(cnt // n)
3
>>> #Überschuss
>>>
>>> print(cnt % n)
1
>>>
Recommended Posts