mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-01-19 00:37:02 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
208b741003
commit
1d034b7243
|
@ -7,10 +7,10 @@ If has only 1 digit, then its super digit is x .
|
|||
Otherwise, the super digit of x is equal to the super digit of the sum of the digits of .
|
||||
For example, the super digit 9875 of will be calculated as:
|
||||
|
||||
super_digit(9875) 9+8+7+5 = 29
|
||||
super_digit(29) 2 + 9 = 11
|
||||
super_digit(11) 1 + 1 = 2
|
||||
super_digit(2) = 2
|
||||
super_digit(9875) 9+8+7+5 = 29
|
||||
super_digit(29) 2 + 9 = 11
|
||||
super_digit(11) 1 + 1 = 2
|
||||
super_digit(2) = 2
|
||||
|
||||
|
||||
ex -2:
|
||||
|
@ -24,8 +24,7 @@ super_digit(P) = super_digit(148148148)
|
|||
= super_digit(1+2)
|
||||
= super_digit(3)
|
||||
= 3
|
||||
"""
|
||||
|
||||
"""
|
||||
|
||||
"""
|
||||
|
||||
|
@ -37,6 +36,8 @@ Sample Output 0
|
|||
3
|
||||
|
||||
"""
|
||||
|
||||
|
||||
def superDigit(n, k):
|
||||
# Calculate the initial sum of the digits in n
|
||||
digit_sum = sum(int(digit) for digit in n)
|
||||
|
@ -50,7 +51,8 @@ def superDigit(n, k):
|
|||
|
||||
return total_sum
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
if __name__ == "__main__":
|
||||
first_multiple_input = input().rstrip().split()
|
||||
|
||||
n = first_multiple_input[0]
|
||||
|
|
Loading…
Reference in New Issue
Block a user