Skip to content

Commit

Permalink
Create pythagoras.py
Browse files Browse the repository at this point in the history
  • Loading branch information
madfolio authored Apr 23, 2017
1 parent a47a192 commit 9f6a71b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions math/pythagoras.py
Original file line number Diff line number Diff line change
@@ -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!"

0 comments on commit 9f6a71b

Please sign in to comment.