Skip to content

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

Notifications You must be signed in to change notification settings

Fran0616/rightTriangle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

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))

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages