Jul-10-2022, 06:13 PM
Play the part of the computer to see why your program doesn't work
This assumes that the problem must be solved mathematically instead of just converting everything to str and concatenating (and maybe converting the result tack to an int).
Output:digits = [1, 2, 12, 123]
e1 result result*10 result*10+e1
1 0 0 1
2 1 10 12
12 12 120 132
123 132 1320 1443
For two and 3 digit numbers you are not "shifting" result enough. If e1 has 2 digits you need to multiply result by 100. If e3 has 3 digits you need to multiply result by 1000.This assumes that the problem must be solved mathematically instead of just converting everything to str and concatenating (and maybe converting the result tack to an int).