import string
list1 = [1, 2, 3, 6]
list2 = [1, 2, 4]
pairs = zip(string.ascii_uppercase, list1)
var = {k if v in list2 else k+'1': v for k,v in pairs}
print(var)
print(var['A'], var['B'], var['C1'], sep="\n")
print(f"{var['A']=}\n{var['B']=}\n{var['C1']=}")
In [4]:
{'A': 1, 'B': 2, 'C1': 3, 'D1': 6}
1
2
3
var['A']=1
var['B']=2
var['C1']=3
list1 = ['one', 'two', 'three', 'six']
list2 = []
list3 = []
contain_flag = False
for item1 in list1:
for item2 in list2:
contain_flag = False
if (item1 == item2):
contain_flag = True
break
list3.append(contain_flag)
print (list3)