# 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.")
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter