How do you make a dictionary inverse and then use that to swap letters in a string in Python : <p>quick explanation of what im trying to do. I've been wondering how to inverse a dictionary as im trying to make a Monoalphabetic cipher which will help me for a challenge soon. My aim after learning how to inverse a dictionary is to be able to use that to swap letters in a string.</p>

<p>This is what i have right now not much at all but it would be awesome if someone could help me out as i've been trying for a long time but i have no idea how to.</p>

<pre><code>dicta = {
    'a': 'M',
    'b': 'N',
    'c': 'B',
    'd': 'V',
    'e': 'C',
    'f': 'X',
    'g': 'Z',
    'h': 'A',
    'i': 'S',
    'j': 'D',
    'k': 'F',
    'l': 'G',
    'm': 'H',
    'n': 'J',
    'o': 'K',
    'p': 'L',
    'q': 'P',
    'r': 'O',
    's': 'I',
    't': 'U',
    'u': 'Y',
    'v': 'T',
    'w': 'R',
    'x': 'E',
    'y': 'W',
    'z': 'Q',
    ' ': ' ',
}
print(dicta)
</code></pre>
