Reading Time: 1 minutes
Area of a room in Python
Given two dimensions of a room, how to carry out the simple task of calculating the area using Python.
## Calculate the area of a room # Get inputs from user unit = input("Enter the unit of dimensions (e.g. feet, yards): ") length = float(input("Enter the length of the room: ")) breadth = float(input("Enter the breadth of the room: ")) # Calculate the area area = length * breadth # Outputting area onto the screen print("The area of the room is", area, "square", unit)
Try it here.