How to use another function to get point values from a list
<p>So I am not sure how I am to go about doing this problem, but from my understanding I am suppose to use another function to get points from a list of 52 numbers and then I am suppose to return a list that contains the sum of the points from the different integers from the list.</p>

<p>What the question asks:</p>

<p>write a function that takes, as an argument, a list of natural numbers between 1 and
52, inclusive, and uses Practice Problem 3 to return a list containing all of the distinct possible sums of
the point values of all of the cards corresponding to the numbers in the list.</p>

<p>So to start practice problem 3 assigns point values to a list of 52 integers.
It's code:</p>

<pre><code>def getPoints(n):
n = (n-1) % 13 + 1
if n == 1:
    return [1,11]
if 2 &lt;= n &lt;= 10:
    return [n]
if 11 &lt;= n &lt;= 13:
    return [10]
</code></pre>

<p>Now I am to make a new function utilizing function 3 to obtain points for a list of numbers I choose from the 52 numbers.</p>

<p>Here is my code for the new function:</p>

<pre><code>def getPointTotal(aList):
for i in aList:
    points = getPoints(i)
return aList, points
</code></pre>

<p>It isn't complete because I am stuck. Right now as it sits I get.</p>

<pre><code>&gt;&gt;&gt;getPointTotal([10, 1])
&gt;&gt;&gt;[12, 1], [10] # 12 is worth 10 points
</code></pre>

<p>So I noticed it was only taking one integer from the list of 52 numbers, but I don't know how to make to get more than one of the integers from the list.</p>

<p>I've tried moving the return inside the loop but then it gives me:</p>

<pre><code>&gt;&gt;&gt;getPointTotal([8, 11])
&gt;&gt;&gt;[8, 11], [10] #11 is worth 10 points
</code></pre>

<p>How do I get the called function to go over more than one item?</p>

<p>you need to append the results of the inside of your loop, not overwrite:</p>

<pre><code>def getPointTotal(aList):
  points = []
  for i in aList:
      points += getPoints(i)
  return aList, points
</code></pre>

python list python-3.x