I have two lists, for example:
A = [1, 2, 3, 4 ,5]
and
B = [23, 34, 44, 43, 32]
I have initialized an empty dictionary
D = {}
I want to pick an element from A as key and pick the corresponding element from B as value. For example the dictionary should look like:
D = {1: 23, 2: 34, 3: 44, 4:43, 5:32}
So far, I have done the following:
D = {}
for k in A:
for j in B:
D[k] = j
print("D is", D)
This only gives me an output as follows:
D = {1: 32, 2: 32, 3: 32, 4:32, 5:32}
For some reason, it only pulls the last value from B which is not desirable. Please help.