+ 1
can anyone show me an example to find area of a rectangle using function
4 Respostas
0
here is an example with predefined variables.
you could make it so that it accepts user inputs for length and width. you could also make the function return the result only and print it in another line of code, there are many possibilities.
here is a basic one :
def findArea(length, width) :
area = length * width
print("the area of the rectangle is : "+ str(area))
length = 4
width = 2
findArea(length, width)
0
in which programming language?
0
def findArea(length, width) :
areaCurrent = length * width
print("the area of the rectangle is : "+ str(areaCurrent))
length = 4
width = 2
findArea(length, width)