I am taking user input as follows: 0,1,2,3,5 The user can write any number and separate it with a comma, the input will be x,y,z,k,c
Then I am having trouble checking if any of the number after split() is invoked is 0 or more than 30.
Code-snippet:
numbers = input(user[i]['name'] +
", assign 10 different numbers between 1-30 (separate each with a comma ','): ")
usrNums = numbers.split()
for number in usrNums:
if number < 1 or number > 30:
#Something goes here, however, not important now.
P.s. I've read a little bit on all()
Clarification: The user inputs some numbers e.g. 0,5,2,9,7,10
the usrNums = numbers.split()
split()
is invoked and these are stored in usrNums
, then I want to check each number in usrNums [0, 5, 2, 9, 7, 10]
if any of them is "0 meaning number < 1 or > 30".
EDIT: NO THIS IS NOT A DUPLICATE, I read through, How can I read inputs as integers in Python?, and it isn't the same at all. My question is about user inputting numbers with separated commas, not one number per input.