Hawk Student Hawk Student - 8 months ago 39
Python Question

Set list to a certain length and range

This is my problem..

write a function that takes, as an argument, a list named aList. It returns a Boolean value True if the elements in the list contains at least one integer and no more than six integers whose values range between 1 and 6. It returns the Boolean False if the list contains any other elements (like strings, or integers outside of the range) or is the wrong length (in that it contains either 0 or more than six elements). Call this function checkList(aList).

I have the length figured out, but can't seem to get it to set the values range between 1 and 6. I am getting the error "List object is not callable." Here's what I have so far:

def checkList(aList):
if 1<=len(aList)<=6 and range[aList(1,6)]:
return True
return False


Use set(aList) <= set(range(1, 6)).