accepting multiple user inputs separated by a space in python and append them to a list

s = raw_input("Please enter your numbers: ")

mynums = [int(i) for i in s.split()]
# OR
mynums = map(int, s.split())

Leave a Comment