Solved
My exercise is to write a function called list_check, which accepts a list from the user and returns True if every element in the userlist is itself also a list.
The bottom line is I would like to see a working example of this problem solved using user input, which is more difficult than just supplying the list yourself.
This is the closest I’ve come accepting the user’s input for the list:
userlist = []
number_of_elements = int(input("Enter the number of elements in your list: "))
for i in range(0, number_of_elements):
element = input().split()
userlist.append(element)
if all(isinstance(element, list) for element in userlist):
print("True")
else:
print("False")
The working code without user input is as follows:
customlist = [[1,2,3],[2,3,4], False]
def list_check(customlist):
answer = all(type(l) == list for l in customlist)
print(answer)
list_check(customlist)
False
Appreciate the help. - J