Intermediate Python- 24.2 Practice help- “Define the methods” | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Intermediate Python- 24.2 Practice help- “Define the methods”

Please help! Thanks! The given code takes 2 numbers as input and calls the static area() method of the Shape class, to output the area of the shape, which is equal to the height multiplied by the width. To make the code work, you need to define the Shape class, and the static area() method, which should return the multiplication of its two arguments. Code: w = int(input()) h = int(input()) print(Shape.area(w, h))

18th Jul 2021, 4:01 PM
Zach Z
5 Answers
+ 5
class Shape: @staticmethod def area(width,height): return width * height w = int(input()) h = int(input()) print(Shape.area(w, h))
30th Jul 2021, 5:45 PM
JaScript
JaScript - avatar
+ 1
I think so ypu need to make area method
18th Jul 2021, 4:10 PM
Atul
Atul - avatar
+ 1
Im not sure what to do next?
20th Jul 2021, 7:19 PM
Zach Z
+ 1
✩✮★✮✩ , Simba , A͢J , JaScript , ChaoticDawg you have all been super helpful. Can anyone help here? Thaks!
30th Jul 2021, 5:29 PM
Zach Z
+ 1
Thank you JaScript !!
8th Aug 2021, 8:52 PM
Zach Z