t_area

$4.99

Category:

Description

The area of a triangle is given by the formula Area = 1/2 * Base * Height. Using the IDLE development environment, create a Python script named t_area . Your script must calculate the area of a triangle and display the results of the calculation. The triangle that your script must calculate the areas for has a base of 12 inches and a height of 16 inches. IDLE has both an interactive mode and a script mode. You must use the script mode to develop your script.

Your script must use (at a minimum) the following three variable names.

area – this variable will contain the results of the calculation which will be the area of the triangle.

base – this variable will contain the length of the triangle base. You must set the value of this variable to 12.

height – this variable will contain the height of the triangle. You must set the value of this variable to 16.

Your script must have at least 2 comments that describe what is happening in your script. Comments may describe the assignment of a value to a variable, the computation of area and the assignment of the result to the variable area, or the display of the result.

Your script must display the results of your calculation computing the area of the triangle using the print statement. You must code your script, test it, and if required, debug it. When you have successfully completed this assignment please capture the output displayed by your script. You can copy and paste the output from the IDLE window into a document and attach it to your assignment.

Example:

The following shows and example python script that computes the area of a circle. The area of a circle is given by the formula area = pi * radius squared

assign the value 3.14 to the variable pi

pi = 3.14

assign the value 8 to the variable radius

radius = 8

assign the results of the operation to the variable area

the operation multiplies radius by radius and then multiplies the result by

the value of pi

area = pi * (radius * radius)

print the value of area

print(area)

Solution provided in PDF form. Not source code.