I am solving an exercise that first of all I have to test if the argument received is a tuple. If yes, I have to test if all its elements are tuples of 2 elements, where the 1st is a string, and the 2nd is an integer.
I know that to test if it is touble is used:
isinstance(t[i], tuple)
To test if 1st element is string:
isinstance(t[0], str)
To test if the 2nd element is integer:
isinstance(t[1], int)
My question is: how do I test if all the elements of the tuple are tuples of 2 elements?