Python Practice Lab
easyUnit 2 · Data Types: int, float, complex

P4. Rectangle Measurements

Data Types: int, float, complex

Read the length and width of a rectangle as decimal numbers. Print its area, perimeter and diagonal. The diagonal is (length² + width²) raised to the power 0.5.

Input Format

  • Line 1: length
  • Line 2: width

Output Format

  • Line 1: Area: <value>
  • Line 2: Perimeter: <value>
  • Line 3: Diagonal: <value>
  • All values rounded to 2 decimal places

Constraints

  • 0 < length, width ≤ 10000

Sample Test Cases

Sample 1
Input
3
4
Output
Area: 12.00
Perimeter: 14.00
Diagonal: 5.00
Sample 2
Input
2.5
1.2
Output
Area: 3.00
Perimeter: 7.40
Diagonal: 2.77

Submitting checks 2 sample cases and 4 hidden test cases.

Hints

Saved
Custom 1

This is your own input, so Run will show what your program prints but can't say whether it's correct.