Can anybody tell me how to find area of a rectangle using function arguments in Python | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Can anybody tell me how to find area of a rectangle using function arguments in Python

28th Dec 2020, 7:56 AM
Deepak Murmu
Deepak Murmu - avatar
8 Réponses
+ 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
28th Dec 2020, 10:28 AM
Lothar
Lothar - avatar
+ 4
Show your attempt first
28th Dec 2020, 8:28 AM
Krish
Krish - avatar
+ 3
Deepak Murmu Post your attempt first to get help from the community
28th Dec 2020, 8:33 AM
Alphin K Sajan
Alphin K Sajan - avatar
+ 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!
12th May 2021, 2:02 AM
Vishal Sharma
Vishal Sharma - avatar
0
length = input(int()) width = input(int()) print(length * width) Remember: A = l * w
28th Dec 2020, 8:10 AM
Dino Wun (Use the search bar plz!)
Dino Wun (Use the search bar plz!) - avatar
0
I know this method I am asking how can I find the area of a rectangle using Function arguments
28th Dec 2020, 8:26 AM
Deepak Murmu
Deepak Murmu - avatar
0
I am not able to understand actually
28th Dec 2020, 8:34 AM
Deepak Murmu
Deepak Murmu - avatar
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...!
6th Mar 2022, 2:52 PM
Nikhila