-3

I am trying to find the element of List_00 or List_01 that are both in a single list named as combined_list. How can I find that?

#consists intergers
list_00 = [1, 2, 33, 100, 69]

#consists strings
list_01 = ['Jack', "Sam", "Trump"]

#both list combined in a single list to perform other experimental operations
combined_list = [list_00 , list_01]

#desired output: any single item of any of the above list 
The Dead Guy
  • 55
  • 1
  • 9

1 Answers1

1

It is same as you did it, just access the elements of the combined_list using the index number as for a 2D array:

>>> list_00 = [1, 2, 33, 100, 69]
>>> list_01 = ['Jack', "Sam", "Trump"]
>>> combined_list = [list_00 , list_01]
>>> print(combined_list)
[[1, 2, 33, 100, 69], ['Jack', 'Sam', 'Trump']]
>>> print(combined_list[0][1])
2
>>> print(combined_list[1][2])
Trump
sam2611
  • 416
  • 3
  • 12