Skip to content

Commit

Permalink
Create findright.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlover101 authored Mar 9, 2022
1 parent 0f36391 commit 9e112f7
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions eqsolvcarlover101/equation/findright.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
class findright():
def __init__(self):
import math
import os
if os.name == "nt":
os.system("cls")
else:
os.system("clear")

leghyp = input("Which side length is missing? (leg/l or hypontenuse/h): ").lower()
lengths = input("Enter the other two side lengths separated by commas: ")
lengths = lengths.split(",")

if leghyp == "hypotenuse" or leghyp == "h":
print(math.sqrt((int(lengths[0])**2 + int(lengths[1])**2)))

elif leghyp == "leg" or leghyp == "l":
try:
print(math.sqrt(int(lengths[0])**2 - int(lengths[1])**2))

except:
print(math.sqrt(int(lengths[1])**2 - int(lengths[0])**2))

0 comments on commit 9e112f7

Please sign in to comment.