Q:

How to check if input is in a array and print the corresponding element of another array?

If I'm making a "translator" and for each letter i'm assigning a world (like cat = a, dog = b...) can i just make 2 arrays where the "translation" of every letter in the first array corresponds to the element with the same position of the letter itself in the other array for example
array_1 = ["a", "b"]
array_2 = ["cat", "dog"]

def translation(phrase):
     translation = ""
     for letter in phrase:
     if letter in array_1:
          translation += #the element of array_2 in the same position of the element of array_1 witch is equal to letter

     return translation

print(translation(input()))

A:

You could use two lists. However, a much better solution is to use dictionary values. That way, you simply enter a key (the input word) and are given the value it translates to. You can use this:
dictionary = { 'a': 'cat', 'b' : 'dog'}

and can easily add more translations with the form of input : output to more easily see what each input translates to. The way to then translate a word is to, for each input, type
dictionary[input]

and you will be given the correct output. For example, dictionary['a'] will return 'cat' in this example. This cuts away on time counting what position each key and output are in each list to make sure they match up.
To translate multiple characters in a row, use this:
dictionary = { 'a': 'cat', 'b' : 'dog'}
undecoded="abbabaa"
decoded=""
for i in undecoded:
    decoded=decoded+dictionary[i]
print(decoded)

Hope this helps! -Theo
Edit: As juanpa.arrivillaga mentions, if you already have two lists that you want to transition into dictionary form, you can use dictionary=dict(zip(array_1, array_2))

