File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 66
77def rebase (input_base : int , digits : list [int ], output_base : int ):
88 """
9- Convert a non-negative integer represented as digits in one base to digits in another base.
9+ Convert a non-negative integer represented as digits in one base
10+ to digits in another base.
1011
1112 :param int input_base: Base of the input digits; must be >= 2.
12- :param list[int] digits: Sequence of digits where each d satisfies 0 <= d < input_base.
13- Leading zeros are allowed; an empty list denotes 0.
13+ :param list[int] digits: Sequence of digits where each d satisfies
14+ 0 <= d < input_base. Leading zeros are allowed;
15+ an empty list denotes 0.
1416 :param int output_base: Base for the output digits; must be >= 2.
15- :returns: Digits of the same number in ``output_base``, without leading zeros
16- (except ``[0]`` for zero).
17+ :returns: Digits of the same number in ``output_base``, without leading
18+ zeros (except ``[0]`` for zero).
1719 :rtype: list[int]
18- :raises ValueError: If ``input_base < 2``, if any digit violates ``0 <= d < input_base``,
19- or if ``output_base < 2``.
20+ :raises ValueError: If ``input_base < 2``, if any digit violates
21+ ``0 <= d < input_base``, or if ``output_base < 2``.
2022 """
2123
2224 # for input.
You can’t perform that action at this time.
0 commit comments