W2.pre_T1

PHOTO EMBED

Mon Jan 02 2023 03:30:05 GMT+0000 (Coordinated Universal Time)

Saved by @Shaghaf_2000 #python

# this program will calculate the third side by using phythegrasos theorm:
import math # this is necessary for the formula particularly sqr
sideA = input("Please enter side A: ")
sideB = input("Please enter side B: ")
sideC = input("Please enter side C: ")

# to find which side is empty use if statement and  to refer to empty in coding is ''

if sideA == '':
    sideB = float(sideB)
    sideC = float(sideC)
    sideA = math.sqrt(sideC**2 - sideB**2)
    print(f"Given side C = {sideC} and side B = {sideB}")
    print(f"Calculated Side A as {round(sideA,4)}")
elif sideB == '':
    sideA = float(sideA)
    sideC = float(sideC)
    sideB = math.sqrt(sideC**2 - sideA**2)
    print(f"Given side C = {sideC} and side A = {sideA}")
    print(f"Calculated Side B as {round(sideB,4)}")
else:
    sideA = float(sideA)
    sideB = float(sideB)
    sideC = math.sqrt(sideA**2 + sideB**2)
    print(f"Given side A = {sideA} and side B = {sideB}")
    print(f"Calculated Side C as {round(sideC,4)}")
content_copyCOPY