Back to General discussions forum
in the last exercises I have done I have tried to find the most optimal way to pass a list of strings to a list of integers, the best I have been able to do is the following: entry = [int (x) for x in input().split()] How else could you use this conversion?
List comprehension [int (x) for x in input().split()]
is good way for Python.
Another approach is using map
function: list(map(int, s.split()))