Build two classes: `Rectangle(w, h)` and `Triangle(b, h)`. Both must implement a polymorphic `area()` method. For Rectangle, return `w * h`. For Triangle, return `0.5 * b * h`. Read four numbers (w, h, b, h). Instantiate both, put them in a tuple, loop through, and print ‘Area: [val]’ formatted to 1 decimal place.
Four space-separated integers: rect_w, rect_h, tri_b, tri_h.
Print the areas sequentially.
Values >= 0
4 5 10 5
Area: 20.0
Area: 25.0
This demonstrates a classic, real-world polymorphic pipeline where an application calculates metrics for diverse objects blindly using a unified method signature.
class Rectangle:
# Define __init__ and area
pass
class Triangle:
# Define __init__ and area
pass
if __name__ == '__main__':
rw, rh, tb, th = map(int, input().split())
# Instantiate, group, loop and print
passEmbedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used