← Python from Scratch Lesson 44 of 78 · 5 XP

Warm-up: area of a rectangle warm-up

Theory and problem statement

Machine translation, not yet reviewed by a native speaker.

A function can have several parameters — they are written separated by commas:

def add(a, b):
    return a + b

print(add(2, 3))   # 5

Task. Write a function area(w, h) that returns the area of a rectangle: the width multiplied by the height.

Sign up for free to solve this task right in your browser: code editor, running, test checks and hints.