To calculate area of rectangle in python, you have to ask from user to enter length and breadth of rectangle to calculate and print area of that rectangle on the output screen as shown in the program given below.
Following python program ask from user to enter length and breadth of rectangle to calculate area:
# Python Program - Calculate Area of Rectangle while True: print("Enter 'x' for exit.") leng = input("Enter length of Rectangle: ") brea = input("Enter breadth of Rectangle: ") if leng == 'x': break else: length = int(leng) breadth = int(brea) area = length*breadth print("Area of Rectangle =",area,"\n")
Here is the sample run of the above Python program shows how to calculate area of rectangle:
You may also like to learn or practice the same program in other popular programming languages: