Rectangle พื้นที่

📋 โจทย์

คลาส Rectangle(w,h) เมธอด area() — รับ w และ h แสดงพื้นที่

⚠️ ข้อจำกัด

w,h ≥ 0

📝 ตัวอย่าง

ตัวอย่างที่ 1
Input:
3
4
Output:
12
🔓 ดูเฉลย
class Rectangle:
    def __init__(self,w,h):
        self.w=w; self.h=h
    def area(self):
        return self.w*self.h
print(Rectangle(int(input()), int(input())).area())
🐍 main.py

กด Run เพื่อรันโค้ด หรือ ตรวจคำตอบ เพื่อตรวจ test cases