diff --git a/math/pythagoras.py b/math/pythagoras.py new file mode 100644 index 000000000..6697e4d3c --- /dev/null +++ b/math/pythagoras.py @@ -0,0 +1,16 @@ +""" +input two of the three side in right angled triangle and return the third. use "?" to indicate the unknown side. +""" + +def pythagoras(opposite,adjacent,hypotenuse): + if opposite == str("?"): + print ("Solving for opposite") + return ((h**2) - (a**2))**0.5 + elif adjacent == str("?"): + print ("Solving for adjacent") + return ((h**2) - (o**2))**0.5 + elif hypotenuse == str("?"): + print ("Solving for hypotenuse") + return ((o**2)+(a**2))**0.5 + else: + return "you already know the answer!"