livepython.net

132. Python Program to Find the Area and Perimeter Using a Function

EasyArguments

Overview

Pass two arguments into a function, in the right order.

Problem Statement

Write a function show_rectangle(length, width) that prints the area and the perimeter of a rectangle, like this for a length of 5 and a width of 4:

Area: 20
Perimeter: 18

Then read the length and the width (whole numbers, one per line) and call the function with them.

Use input() with no prompt text: the tests type the input for you, and a prompt would end up in your output.

Input

One value per line, in this order: the length, then the width. Example:

5
4

Output

The output for that example:

Area: 20
Perimeter: 18

The tests try 3 different inputs.

Learn this firstChapter 15 · Python Function Parameters and Arguments
solution.py
# write your code here

EXPECTED OUTPUT

1Area: 20
2Perimeter: 18

YOUR OUTPUT

Press Run to see your output here. Lines are compared with the expected output.