mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-04-30 09:33:36 +00:00
Update recursive_digit_sum.py
This commit is contained in:
parent
fc8f143dd1
commit
d412a6e612
@ -17,7 +17,8 @@ from __future__ import annotations
|
|||||||
|
|
||||||
def super_digit(n_str: str, repetitions: int) -> int:
|
def super_digit(n_str: str, repetitions: int) -> int:
|
||||||
"""
|
"""
|
||||||
Computes the super digit of a number formed by concatenating n_str repetitions times.
|
Computes the super digit of a number formed by concatenating
|
||||||
|
n_str repetitions times.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
n_str (str): The string representation of the integer.
|
n_str (str): The string representation of the integer.
|
||||||
@ -34,6 +35,7 @@ def super_digit(n_str: str, repetitions: int) -> int:
|
|||||||
9
|
9
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
# Calculate the initial sum of the digits in n_str
|
# Calculate the initial sum of the digits in n_str
|
||||||
digit_sum = sum(int(digit) for digit in n_str)
|
digit_sum = sum(int(digit) for digit in n_str)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user