Python math module doesn't have abs
<p>Hi this is a piece of code that is supposed to create a function that returns the absolute value of the inputted integer or float.
Can't seem to figure out what's wrong with it, here's the code and the error. Any help is appreciated!</p>

<p>here is the code for the function:</p>

<pre><code>import math
def distance_from_zero(num):
    type_entry = type(num)
    if type_entry == int:
        return math.abs(num)
    elif type_entry == float:
        return math.abs(num)
    else:
        return "Not an integer or float!"
</code></pre>

<p>here is where I tested out the code by printing the result</p>

<pre><code>print distance_from_zero(4)
</code></pre>

<h3>here is the error that occurs</h3>

<pre><code>Traceback (most recent call last):
  File "python", line 12, in &lt;module&gt;
  File "python", line 5, in distance_from_zero
AttributeError: 'module' object has no attribute 'abs'
</code></pre>
