I was trying to make it so something would equal something else Python 2.7.3
Question: I decided to make a code with a friend and wanted to be able to crack (decode)
it with this program. Basically what I want is one word to equal another for
example the word "be" would show in the program as the word "ok".

So I have the raw_input to put the words to crack in. Say I put in the
sentence "hi friend" how would I get it to come out as for example "dog
crazy". Also if I put in "dog crazy" to come out as "hi friend".

Sorry if this is hard to understand but I'm not sure how to explain it to
well.

I am using Python 2.7.3. Thanks.


Answer: 
    import operator
    
    mapping={
        'hi':       'dog',
        'friend':   'crazy',
    }
    
    for k,v in list(mapping.items()):
        mapping[v]=k
    
    print(' '.join(map(lambda w: mapping.get(w,w),input().split())))
    

