weekly coding P1

PHOTO EMBED

Sat Jan 14 2023 14:28:43 GMT+0000 (Coordinated Universal Time)

Saved by @Shaghaf_2000 #python

# weekly coding exercise propleam 1:
"""
This program will calculate the perimeter of a rectangle
Take two inputs:
1. width  
2. length 
- do some validation
- convert to float and 2 D.P

"""
width = input("Enter width in centimeters: ")
length = input("Enter length in centimeters: ")

p = 2*(float(width)+float(length))
if width == length:
    print("Incorrect inputs")
else:
    print(f"The perimeter of a rectangle with width {round(width,2)}cm and length{round(length,2)}cm is {round(p,2)}cm.")
content_copyCOPY