Checking if a list contains a sublist | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 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
2 Réponses
+ 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