voldyy
Coder
Hi, how can i change this code to work for two-digit numbers or three-digit number?
For now only work for single digit numbers, tried to change algorthm but didnt work.
Now the ouput is 2221 - i think is because of this line result=result + el
It has to output this:
input: [ 21, 12, 1]
output: 21121
For now only work for single digit numbers, tried to change algorthm but didnt work.
Python:
def to_number(digits):
result=digits[0]
for el in digits[1:]:
result=result*10
result=result + el
return result
Now the ouput is 2221 - i think is because of this line result=result + el
It has to output this:
input: [ 21, 12, 1]
output: 21121