How can I iterate throughout two unknown list with and unknown amount of sublist and unknown elements. What I am looking to do is to compare them and return true if they are the same length and False if not the same length and not the same type of element in the specific indicie. My Code So Far:
def similarList(list1,list2):
if len(list1)!=len(list2):
return False
else:
if len(list1)>1 and len(list2)>1:
This is where I am not sure how to compare each element of the list1 and list2.
EDIT: example: similarList([0],[4]) True similarList([3.9],[8]) False similarList([[4,5,6],4] , [[2,3,4],'a']) False because 4 is an INT and 'a' is a STRING
Aucun commentaire:
Enregistrer un commentaire