title: Lambda function for multiplying each element of list with random number between 1 and 10?
body: <p>I'm stuck on this question since I am fairly new to functional programming in python. Any help would be appreciated!</p>
  <p>Note: I understand using map is simpler since we can use an iterable but I need some way of accomplishing this using lambda function only.</p>
  <pre><code>Given the following list, ages of 25 people:
  ages = [79, 91, 25, 22, 95, 69, 47, 87, 87, 2, 13, 94, 50, 73, 29, 87, 81, 51, 32, 69, 10, 91, 45, 7,
  51]
  Q: Make a new list in which you multiply each age with a random number between 1 to 10
  (Generate a random number for each age and multiply them together). Only use Lambda
  Function for the multiplication. (You can use random generator provided by in python to
  generate the random numbers)
  </code></pre>
  <p>This is what I have so far:</p>
  <pre><code>import random
  
  inconsistent = []
  ages = [79, 91, 25, 22, 95, 69, 47, 87, 87, 2, 13, 94, 50, 73, 29, 87, 81, 51, 32, 69, 10, 91, 45, 7,
  51]
  
  for i in range(25):
      inconsistent.append(random.randint(1,10))
  print(inconsistent)
      
  x = lambda a,b: a*b
  x(ages, inconsistent)
  </code></pre>
  <p>The following is the error that I get:</p>
  <pre><code>TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-24-646727e92091&gt; in &lt;module&gt;
       10 
       11 x = lambda a,b: a*b
  ---&gt; 12 x(ages, inconsistent)
  
  &lt;ipython-input-24-646727e92091&gt; in &lt;lambda&gt;(a, b)
        9 print(inconsistent)
       10 
  ---&gt; 11 x = lambda a,b: a*b
       12 x(ages, inconsistent)
  
  TypeError: can't multiply sequence by non-int of type 'list'
  </code></pre>