Converting a List Into Float Variables
<p>I'm wanting to take an input as a list but use each variable as a float. Is there a simpler way to make this conversion other than explicitly like I do below, as a list is defined with strings, and I want to, for example, add rather than concatenate:</p>

<pre><code>edges = input("Enter three edges: ").split(", ")  
print("The perimeter is", (float(edges[0]) + float(edges[1]) + float(edges[2])))
</code></pre>

<p>map is your friend</p>

<pre><code>sum(map(float, edges))
</code></pre>

<p>or a generator expression</p>

<pre><code>sum(float(f) for f in edges)
</code></pre>

<p>Have fun!</p>

python list python-3.x floating-point