Ask coding questions

← Back to all posts
State a line number that shows a function call.
MariamMohammedM (0)

Calling functions

Look at the code below and answer the questions that follow.

p = 3.14
#Area of a circle
print ("This program will find the Area of a Circle")
def circArea(radius):
area = p * (radius**2)
return area

#Area of a rectangle
def rectArea(length, width):
area = length * width
return area

#Area of a triangle
def triaArea(base, height):
area = (base * height)/2
return area
datal = 278
data2 = 34
data3 = input("Enter the width of the rectangle.")

data3 = float(data3)
data4 = input("Enter the height of the rectangle:")
data4 = float(data4)

rArea = rectArea(data3, data4)
tArea = triaArea(datal, data2)
print("The area of the rectangle is:", rArea)
print("The area of the triangle is:", tArea)

Comments
hotnewtop