From what I understand, you wish capturar
all the valores
typed in a single line. That is, you would like to implement a program that solicitar
the typing of the values, the user was able to digita-los
in a single line.
According to my understanding the algorithm would be...
valores = list(map(int, input('Digite os valores: ').split()))
print(f'\033[32mValores digitados: {valores}\033[m')
Note the functioning of the algorithm in repl it..
Note that to correctly utilize this algorithm, you have to:
- Run the algorithm;
- Type
todos
the values in the mesma
line separados
by a espaço
;
- Put pressure on
Enter
.
Also note that this algorithm is capable of capturing a number indefinido
of values.
But if the numbers are in the format
2 4 5 3 5 0 4
thennum = int(input())
will never work. Itselfsplit
which has in question already returns a list. What exactly is the doubt ?– Isac