+ 1

Checking if a list contains a sublist

If someone could please give a simple code for this one it'd be really helpful

15th May 2020, 1:29 PM
Sriya
4 Answers
+ 1
U cant ask user to code for u
15th May 2020, 1:35 PM
Abhay
Abhay - avatar
0
This is some simple code to get you started: def contains_sublist(collection): for item in collection: #iterate through each item if type(item) is list: #if item in collection is a sublist return True return False Hopefully you'll be able to modify it for more complex use.
15th May 2020, 1:35 PM
Jianmin Chen
Jianmin Chen - avatar