Program to calculate area and perimeter of a rhombus whose diagonals are given | Python 3 Program to calculate area and perimeter of a rhombus using diagonals ; calculate area and perimeter of a rhombus ; Driver code
from math import sqrt , pow NEW_LINE def rhombusAreaPeri ( d1 , d2 ) : NEW_LINE INDENT area = ( d1 * d2 ) / 2 NEW_LINE perimeter = 2 * sqrt ( pow ( d1 , 2 ) + pow ( d2 , 2 ) ) NEW_LINE print ( " The ▁ area ▁ of ▁ rhombus ▁ with ▁ diagonals " , d1 , " and " , d2 , " is " , area , " . " ) NEW_LINE print ( " The ▁ perimeter ▁ of ▁ rhombus ▁ with ▁ diagonals " , d1 , " and " , d2 , " is " , perimeter , " . " ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT d1 = 2 NEW_LINE d2 = 4 NEW_LINE rhombusAreaPeri ( d1 , d2 ) NEW_LINE DEDENT