livepython.net

47. Python Program to Explain a Calculation with Comments

MediumGood comments

Overview

Explain a formula so that a reader understands why it works.

Problem Statement

A garden is 8 metres long and 5 metres wide. Store both in variables, calculate the area and the perimeter, explain each formula with a comment, and print:

Area: 40
Perimeter: 26

Input

No input is required for this question.

Output

Area: 40
Perimeter: 26

Learn this firstChapter 6 · How to Write Good Comments in Python
solution.py
# write your code here

EXPECTED OUTPUT

1Area: 40
2Perimeter: 26

YOUR OUTPUT

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