-2
codigo = input('Digite um numero: ')
for i in codigo:
print(f'{i} |', end='')
generates this result, ok
> Digite um numero: 21853
> 2 |1 |8 |5 |3 |
> Process finished with exit code 0
below add int it generates error, as it would solve without taking the int from the code
codigo = int(input('Digite um numero: '))
for i in codigo:
print(f'{i} |', end='')
generates this result, error!
for i in codigo:
TypeError: 'int' object is not iterable
You can edit the question to make the corrections.
– Danizavtz
If one of the answers below solved your problem and there was no doubt left, choose the one you liked the most and mark it as correct/accepted by clicking on the " " that is next to it, which also marks your question as solved. If you still have any questions or would like further clarification, feel free to comment.
– Lucas
What would be the reason to use int()? From your code it simply looks like the int there is not needed, you could convert it to int() after for(), but instead it turns out that it converts a string to int and then has to convert it back to str. Can you explain the problem better Ricardo? cc @Lucas
– Guilherme Nascimento