[Tutor] Return problems

Roger Lea Scherer rls4jc at gmail.com
Fri Apr 6 20:50:35 EDT 2018


So I've examined my educational material, I've perused the python
documentation and for the life of me I can't figure out why return doesn't
print a result in the IDE. I use print, the program acts as expected. What
am I missing?

import math

from decimal import Decimal

def findHypot(a, b):
    c = math.sqrt((a ** 2) + (b ** 2))
    if c == (round(c)):
        return round(c)
    else:
        return round(c, 4)

findHypot(3, 4)

from the IDE:

===== RESTART: C:\Users\Roger\Documents\GitHub\LaunchCode\hypotenuse.py
=====
>>>

Thank you as always.

-- 
Roger Lea Scherer
623.255.7719


More information about the Tutor mailing list