+ 1

Please help me with this code.

# To calculate the Area and the Perimetre of a rectangle. d = str(input("Type A for Area and P for Perimetre: ")) d = d.upper() if d != "A" or "P": print("You have Entered a wrong letter.") exit() b = float(input("Enter the Length in cm (in cm): ")) c = float(input("Enter the Breath in cm (in cm): ")) if d == "A": print("Area of the rectangle is: ", (b * c), "cm^2") elif d == "P": print("Perimetre of the rectangle is: ", (2 * (b + c)), "cm")

9th Mar 2021, 1:07 PM
Shrish Kumar Saini
Shrish Kumar Saini - avatar
2 ответов
+ 3
Corrected !! #To calculate the Area and the Perimetre of a rectangle. d = input("Type A for Area and P for Perimetre: ") d = d.upper() if (d != "A") and (d != "P"): print("You have Entered a wrong letter.") exit() b = float(input("Enter the Length in cm (in cm): ")) c = float(input("Enter the Breath in cm (in cm): ")) if d == "A": print("Area of the rectangle is: ", (b * c), "cm^2") elif d == "P": print("Perimetre of the rectangle is: ", (2 * (b + c)), "cm")
9th Mar 2021, 1:17 PM
Ayush Kumar
Ayush Kumar - avatar
+ 1
thankyou very much 丹ⓨㄩک廾
9th Mar 2021, 1:25 PM
Shrish Kumar Saini
Shrish Kumar Saini - avatar