Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created September 13, 2021 03:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IndhumathyChelliah/eb0a7a2785da4fe7ddcc1ce434c970e0 to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/eb0a7a2785da4fe7ddcc1ce434c970e0 to your computer and use it in GitHub Desktop.
my_list=[['red','orange'],['apple','banana','orange'],['carrot']]
result=[(i1,i2) for (i1,v1) in enumerate(my_list) for (i2,v2) in enumerate(v1) if v2=='orange']
print(result)
#Output:
[(0, 1), (1, 2)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment