How do I gather user numerical input into a list in Python?

Bennett

I'm new to Python and am trying to make a simple program to calculate mean median and mode from numbers input by user. So far I have:

num=[]
UserNumbers=int(input("Enter number sequence separated by spaces: "))
num.append(UserNumbers)
print (num)

I want the user to be able to input multiple int's separated by spaces, however my code only accepts one number. The mean/median/mode part shouldn't be hard as I'm just going to use statistics package in 3.4; just need help with gathering input.

Acsisr

You have to parse the answer if you want it this way.

UserNumbers=input("Enter number sequence separated by spaces: ")
nums = [int(i) for i in UserNumbers.split()]

EDIT:

Duplicate of this question

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How do I convert user input into a list?

How do you check if input is numerical in Python?

How do i validate a user input in python?

How do I add user input to a list and total up that list?

How do I make python take multiple horizontal lines of numerical input and output the same lines?

How do I sort list in python with user input and values between 1 and 100 and no repeating values?

How do I search a SQL List inside of python to check if the username matches a user input?

Comparing numerical input in python list

How do I compare user input to an uppercase letter string in a list?

How do I replace a certain string in a list from user input?

how do I add a word to a list with user input

How do I make the user input reflect in the new list created?

python3: how do i ask a user for input to select a specific list, (yes or no) and then print the items in that specific list in a random order?

How do I get user input from discord chat in python?

How do I get the user to input a number in Python 3?

How do I make a loop for user input in python?

Python- how do I write user input to an Excel file?

How do I check user input against multiple lists python?

How do I get Python to print from 1 to user input?

How do i print a list of names (from user input) in the format of "First Initial. Last Name"? (python 3)

Python 3: How do I make a game using user input and retrieving answer from a list of dictionaries, then use a point system?

How do I update a Label with a numerical value with python?

How do I loop a python list input validation?

How can I print a list by user input?

How can I assign a numerical value to every word in a text file or user input in java

How can I efficiently convert a user-input char into a numerical value (double) in Java?

How do I limit my user input

How do i validate integer as user input?

How do I prompt for user input in AutoHotkey?