commit end
This commit is contained in:
parent
3a3cdebf45
commit
1767c1daf5
13
main.py
13
main.py
@ -1,10 +1,21 @@
|
||||
# Практика
|
||||
|
||||
def is_armstrong(a):
|
||||
|
||||
true_a = a
|
||||
armstrong = 0
|
||||
count = len(str(a))
|
||||
count2 = count
|
||||
while count2!= 0:
|
||||
armstrong = armstrong + ((a%10)** count)
|
||||
a = a//10
|
||||
count2-=1
|
||||
if armstrong == true_a:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(is_armstrong(153))
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user