cs/practical-file/answers/question_03.py

9 lines
349 B
Python

# Question: Write a Python program to accept the length and width of a rectangle and compute its perimeter and area.
length = float(input("Enter the length of the rectangle: "))
width = float(input("Enter the width of the rectangle: "))
perimeter = 2 * (length + width)
area = length * width
print(f"Perimeter: {perimeter}")
print(f"Area: {area}")