Skip to content

Latest commit

 

History

History
29 lines (16 loc) · 1.09 KB

README.md

File metadata and controls

29 lines (16 loc) · 1.09 KB

rightTriangle

#this code will take user input from a right triangle and solve the area of the triangle

A right triangle consist of three side. Two legs and an hypotenuse. This code will take the value of two legs from user and find the hypotenuse.

Formula - The formula for calculating a right truangle is

Variable

legA - This variable is the first leg and will store the value for that leg

legB - This varaibles holds the value for the second leg.

Function str() - This function cinverts valurs into a string. In this code it will work with the print function to calculate the hypotenus of a given right triangle.

str() The formula will square legA and legB, then calculate the sum and finaly the sum will be raise to the power of .5 and this will gove you the result.

Code:

print ("This code will find the hypotenus of a right triangle")

legA = float(input("Input first leg length: "))

legB = float(input("Input second leg length: "))

print ("Hypotenuse leength is " + str((legA2 + legB2) ** .5))