how do I separate and store the items of a tuple within a tuple to their respective (new) tuple?
the code below is what I'm working.
**the output I want is:
unique_num = (45, 21, 10, 24, 2) unique_ words = ('foot', 'basket', 'hand', 'foot', 'hand')**
def unique_data_items(data):
unique_num = ()
unique_words = ()
for items in data:
for values in items:
if values == int:
unique_num= unique_num + values
elif values == str :
unique_words= unique_words + values
return ((unique_words), (unique_num))
data = ((45, 'foot'), (21, 'basket'), (10, 'hand'), (24, 'foot'), (21, 'hand'))
print(unique_data_items(data))
I've tried to approach this in a different way and it worked but I wanna know why this way isn't working