Fix: Ensure all skills are tracked as files, not submodules
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
def change_base(x: int, base: int):
|
||||
"""Change numerical base of input number x to base.
|
||||
return string representation after the conversion.
|
||||
base numbers are less than 10.
|
||||
>>> change_base(8, 3)
|
||||
'22'
|
||||
>>> change_base(8, 2)
|
||||
'1000'
|
||||
>>> change_base(7, 2)
|
||||
'111'
|
||||
"""
|
||||
if x == 0:
|
||||
return '0'
|
||||
result = ''
|
||||
while x > 0:
|
||||
result = str(x % base) + result
|
||||
x //= base
|
||||
return result
|
||||
Reference in New Issue
Block a user