Checking if the value for the key is the same as before
<p>I have been working on this code and I cannot find a answer.</p>

<ol>
<li><p>I have 2 lists</p>

<pre><code>point_values = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 1, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10]

letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
</code></pre></li>
<li><p>I want to set <code>a:1</code> and <code>b:3</code> and so on...and I want them put in a dictionary called <code>point_letters</code>.</p></li>
</ol>

<p>This is my starter code.</p>

<pre><code>point_letters = {}
point_values = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 1, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10]
letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

for x in letters:
    for i in point_values:
        if point_letters[x] != i: # is what I'm trying to do
            point_letters[x] = i
print(point_letters)
</code></pre>

<p>How should I do this?</p>

<pre><code>point_letters = dict(zip(letters, point_values))
</code></pre>

<p><code>zip</code> makes a list of pairs of corresponding elements; <code>dict</code> converts the list of pairs to a dictionary.</p>

<p>EDIT: changed the dict name. Also in response to comments, and the posted code:</p>

<blockquote>
  <p>This is great, but I still have not learned this. Is there a way to for loop it?</p>
</blockquote>

<p>In general, in the real world, you'd use the above method. <code>for</code> is very low-level and you'd want to avoid it when you can. For the class, I won't solve your problem, but give you hints instead (so it's not plagiarism):</p>

<ul>
<li><p>You want to pair up the <code>letters[i]</code> and <code>point_values[i]</code> for the same <code>i</code></p></li>
<li><p><code>i</code> should be going from <code>0</code> to the maximum index - one less than the length of your lists</p></li>
<li><p>You can get a length of a list using <code>len</code></p></li>
<li><p>You can get a range using <code>range</code> (Python 3) or <code>xrange</code> (Python 2)</p></li>
</ul>

<p>In your code,</p>

<ul>
<li><p>Having two loops is not what you need to do</p></li>
<li><p>Your <code>if</code> cannot ever be true.</p></li>
</ul>

<p>EDIT2: Changed "array" to "list", because Python has to be a special snowflake.</p>

python dictionary