-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 
Dead Guy
  • 57
  • 1
  • 9
  • 4
    *"Desired output: any single item..."*: `combined_list[0][0]`. If this is not what you expect as output, then please provide the output you expect. – trincot Jul 30 '21 at 17:00
  • Does this answer your question? [common elements in two lists python](https://stackoverflow.com/questions/13962781/common-elements-in-two-lists-python) – blackbrandt Jul 30 '21 at 17:03
  • I want 1 or Jack or any other element in any of two list as output – Dead Guy Jul 30 '21 at 17:04
  • @trincot your answer is correct dude thanks a lot – Dead Guy Jul 30 '21 at 17:08

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
  • 455
  • 5
  • 15