Combining Characters using lambda in python
<p>I want to result using 'str += ' style in the lambda function </p>

<p>example (with error) : </p>

<pre><code>t=lambda text text : [c for c in text str += c.upper()]
t(['h','e','l','l','o'])
</code></pre>

<p>I expect to result as :</p>

<pre><code>HELLO
</code></pre>

<p>How can i fix above lambda function with state variable like 'str +=' style</p>

<p>if 'str +=' style not possible, please explain in detail why the impossible. Do not just Short-Answer that wrong. </p>

<p>I think you mean this:</p>

<pre><code>&gt;&gt;&gt; t = lambda text: ''.join(text).upper()
&gt;&gt;&gt; t(['h','e','l','l','o'])
'HELLO'
</code></pre>

<p>Documentation: <a href="https://docs.python.org/3/tutorial/controlflow.html#lambda-expressions" rel="nofollow">Lambda Expressions</a></p>

python lambda