I am teaching myself python. I need to understand how the reduce function works. I have a solid understanding of how to use reduce for mathematical functions. However, I am trying to perform a more abstract operation to a list of integers and I encountered a problem.
Problem: I would like to take list like
digits= [3,4,3,2,1]
and unpack them such that I get
34421
Approach : I really cannot figure out how to create a lambda function that will extract the integer from the list. My approach is very bad and it is because I don't understand how to apply the function to the list. Also, I should note I am using python 3.
Example Code:
from functools import reduce
digits= [3,4,3,2,1]
reduce(lambda x : x, digits)