# 检查2个列表的元素是否匹配，即使其大写或小写也是如此

list1 = ['circuit', 'Date', 'common', 'discover']
list2 = [('id-23', 'po'), ('id-24', 'date'),('id-25', 'CIRCUIT'), ('id-26', 'discover')]

for i, a in list2:
if a in list1:
kia = i,a
print(kia)

Output im getting is ('id-26', 'discover')

expected output should be ('id-24', 'date'), ('id-25', 'CIRCUIT'), ('id-26', 'discover')

99.90%

Turn list1 into lowercase and then search for the lowercased a in that list

list1 = ['circuit', 'Date', 'common', 'discover']
list2 = [('id-23', 'po'), ('id-24', 'date'),('id-25', 'CIRCUIT'), ('id-26', 'discover')]

list1_lower = [item.lower() for item in list1]  # turn everything to lowercase

for i, a in list2:
if a.lower() in list1_lower:  # search if lowercased a is in list1
kia = i,a
print(kia)

list1 = ['circuit', 'Date', 'common', 'discover']
list2 = [('id-23', 'po'), ('id-24', 'date'),('id-25', 'CIRCUIT'), ('id-26', 'discover')]
list1 = [i.lower() for i in list1]

for i, a in list2:
if a.lower() in list1:
kia = i,a
print(kia)