int.sum_digits()
This commit is contained in:
parent
b0a8388a8b
commit
ec64dce347
@ -1,5 +1,6 @@
|
|||||||
bs4~=0.0.1
|
bs4~=0.0.1
|
||||||
beautifulsoup4==4.11.1
|
beautifulsoup4==4.11.1
|
||||||
fishhook~=0.2.5
|
fishhook~=0.2.5
|
||||||
|
pygame~=2.4.0
|
||||||
requests==2.28.1
|
requests==2.28.1
|
||||||
setuptools==65.6.3
|
setuptools==65.6.3
|
||||||
|
|||||||
@ -183,4 +183,15 @@ def intersection(self, *args) -> str:
|
|||||||
|
|
||||||
@hook(str)
|
@hook(str)
|
||||||
def __and__(self, *args) -> str:
|
def __and__(self, *args) -> str:
|
||||||
return self.intersection(*args)
|
return self.intersection(*args)
|
||||||
|
|
||||||
|
|
||||||
|
@hook(int)
|
||||||
|
def sum_digits(self) -> int:
|
||||||
|
s = 0
|
||||||
|
num = self
|
||||||
|
while num > 0:
|
||||||
|
s += num % 10
|
||||||
|
num //= 10
|
||||||
|
|
||||||
|
return s
|
||||||
Loading…
Reference in New Issue
Block a user