0
Can anybody tell me how to find area of a rectangle using function arguments in Python
9 Respostas
+ 10
Deepak Murmu , to make it clear for you: Before we are going to help you, you should have done a try by yourself first. Please put your code in playground and post it here. Thanks!
To give you some hints:
âȘïžin main program use 2 input statements to get values for length and width
âȘïžconvert the inputs to integer
âȘïžcreate a function e.g. "area(), that can take to function arguments in function header
âȘïžuse these arguments in function to calculate the area
âȘïžin main call the function and pass both input values to it, also store the returned result in a variable
âȘïžuse return in function to give back the result to the caller
âȘïžprint the variable that holds the result
+ 4
Show your attempt first
+ 3
Deepak Murmu Post your attempt first to get help from the community
+ 3
Code: length=int(input())
breadth=int(input())
def area_of_rectangle(value1,value2):
# area_of_rectanle=value1*value2
area=value1*value2
print(area)
area_of_rectangle(length,breadth)
Hope it helps!
0
length = input(int())
width = input(int())
print(length * width)
Remember: A = l * w
0
I know this method
I am asking how can I find the area of a rectangle using Function arguments
0
I am not able to understand actually
0
length = int(input())
width = int(input())
def area(length, width):
#your code goes here
print (length * width )
if length == width:
print ("Square")
area(length,width)
done...!