Python @ DjangoSpin

PyPro #1 Area of a room

Buffer this pageShare on FacebookPrint this pageTweet about this on TwitterShare on Google+Share on LinkedInShare on StumbleUpon
Reading Time: 1 minutes

Area of a room in Python

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.

See also:

Buffer this pageShare on FacebookPrint this pageTweet about this on TwitterShare on Google+Share on LinkedInShare on StumbleUpon

Leave a Reply