arrays - Python - How to check the place value in a list -
python: list checking
i trying write python (2.7.3) program check list see if value of placing list has been given or not?
input = raw_input("(enter 3 numbers separated commas) >: ") input_list = input.split(" ") replacing_letters = [str(x.strip(" ")) x in input_list] 'if replacing_letters[2] blank:' print"incomplete" 'elif replacing_letters[2] full': print replacing_letters so if enter 3 numbers input, print list user. input 2 numbers. return user 'incomplete'.
any suggestions on method or code accomplish this?
you can length of list the len() built-in function. can simple check against this:
if len(input_list) <= 2: ... else: ...
Comments
Post a Comment