Error with the Armstrong problem

I have an error here, I do not understand the reason for the problem if it works perfect, maybe I am not seeing something. It would be helpful if you could help me with this, thank you very much.

1 Like

numero_parseado is a global variable. It’s initially empty and then each time is_armstrong_number() gets called more digits get appended to it. It never gets emptied.

I recommend avoiding mutating global variables when possible. That adds some state to your program and makes reasoning about its behavior more complicated.
Instead, make numero_parseado a local variable.

1 Like

Perfect explanation! The program will work in the first time, but will failure in the next because the Variable numero_parseado will already have value inside!!
Just put this Variable inside the function and it will works! :v:

@Fitoxzz Were you able to fix the error?