[Solved] Finding the position of an item in another list from a number in a different list


You can do something like this :

input_num = 123
list1 = [0, 1, 2, 3, 4] # if list1 is not dervied from input number
list2 = ["0", "hello", "my", "name", "is", "Daniel"]
print(' '.join([list2[list1.index(int(ind))] for ind in str(input_num)]))

This will result in :

hello my name

Also, i would suggest you to look at the https://docs.python.org/2/tutorial/datastructures.html and trying things out to learn.

0

solved Finding the position of an item in another list from a number in a different list