What is the best (and fastest) way, in Python 2.7.x, to check if a string (or any other data type) exists in a nested tuple?
For example:
RECIPES = (
('apple', 'sugar', 'extreme_Force'),
('banana', 'syrup', 'magical_ends'),
('caramel', 'chocolate', 'pancake_MONSTER'),
('banana',('someAnother','banana'))
)
This tuples needs to be checked if banana appears in any of the nested tuple and return the location index, in this case 1,0.
Also, the tuples could be nested to any depth.
Recursive multi-location indexing:
prints