0

Insert method from two lists of ints and strs

I have a list of strings (K) and list of numbers (V), and I need to insert a string from K into a new list just on the place from V. For example: K = [‘p’, ‘n’, ‘y’, ‘h’, ‘o’, ‘t’] V = [1, 6, 2, 4, 5, 3] #receive [‘p’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’] and then use .join() method. line = [] for i, j in V, K: line.insert (V, K) #probably (int(V), K)? Line = “”.join(line) Why this doesn’t work and says me that there are too many values to unpack? How do I change it? Thank you!

17th Jan 2019, 12:44 PM
Daniella
Daniella - avatar
1 Resposta
0
Forgot to mention: I have managed to do it through a dictionary, though still would be happy to understand, what is my mistake in this piece of code...
17th Jan 2019, 12:47 PM
Daniella
Daniella - avatar