Design a logical expression equivalent to the following statement:
xis a list of three or five elements, the second element of which is
To answer the specific question:
isinstance(x[0], (int, float))
This checks if x[0] is an instance of any of the types in the tuple (int, float).
You can add bool in there, too, but it's not necessary, because bool is itself a subclass of int.
Doc reference:
To comment on your current code, you shouldn't rely on interning of short strings. You are supposed to compare strings with the == operator:
x[1] == 'Hip'