Working with python dictionary notation
<p>I'm working on a program where the user inputs 3 values (one of which is in dictionary notation form).. but I'm having trouble finding out how to work with this special notation. </p>

<p>The user input will look like this: </p>

<pre><code>{'X':'X+YF','Y':'FX-Y'} 
</code></pre>

<p>which I store in a variable <code>p</code>. I know that with <code>p.keys()</code> I get <code>['X', 'Y']</code> and with <code>p.values()</code> I get <code>['X+YF', 'FX-Y']</code>. </p>

<p>How can I relate <code>'X'</code> to <code>'X+YF'</code> to say, if the value of the first key in <code>p</code> is <code>'X'</code>, store <code>'X+YF'</code> in a var, and if the value of the second key in <code>p</code> is <code>'Y'</code>, store <code>'FX-Y'</code> in a var?</p>

<hr>

<p>Is something like this also possible with the same approach stated in the answers below?</p>

<pre><code> If x is found in some string :
   swap out the X with the value p['X'] 
</code></pre>
