Rectangle Function
Completed
Write area(w, h) and perimeter(w, h). Read width and height on one line and print both results.
Input
Two integers.
Output
Two lines: area, then perimeter.
Example
Input
3 4
Output
12 14
Editor
Python
Hints
Each function returns one calculation.
Solution explanation
Small, single-purpose functions are easy to test and reuse.
Show solution
def area(w, h):
return w * h
def perimeter(w, h):
return 2 * (w + h)
w, h = map(int, input().split())
print(area(w, h))
print(perimeter(w, h))