I think there should be a question like this already, but I haven't found it. It could be because I don't know the exact concepts/words about what I'm looking for, but here is the example:
I have this code:
group_1 = ['Hello', 'world', '!']
group_2 = [1,23,4,2,5,2]
group_3 = ['A', 'K', 'L']
all_groups = [group_1, group_2, group_3]
for i in all_groups:
print(i, ':', len(i))
It gives this output:
['Hello', 'world', '!'] : 3
[1, 23, 4, 2, 5, 2] : 6
['A', 'K', 'L'] : 3
And this is the expected output:
'group_1' : 3
'group_2' : 6
'group_3' : 3
As you can see, I'm trying to print the names of the callable objects group_1
, group_2
, and group_3
. Any suggestions?