Skip to content

Instantly share code, notes, and snippets.

@jerryalfs
Created January 31, 2016 09:48
Show Gist options
  • Save jerryalfs/7347c5b881a44ff63ea6 to your computer and use it in GitHub Desktop.
Save jerryalfs/7347c5b881a44ff63ea6 to your computer and use it in GitHub Desktop.
Calculate Area Equilateral Triangle With Python
#Area of an equilateral triangle
import math
#to use math function must import lib math
h = input("Enter the height of equilateral triangle : ")
#to input value height and store to variable h
h = float(h)
#convert value have input to be float
a = (h**2 * math.sqrt(3))/3
#formula to calculate the area
print ("The area of an equilateral triangle : ",a)
#print the area with called value have calculate and store at variable a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment