Python Workbook - 02 - Area of a Room

Area of a Room

Level: Easy

Problem:

Write a program that asks the user to enter the width and length of a room. Once the values have been read, your program should compute and display the area of the room. The length and the width will be entered as floating point numbers. Include units in your prompt and output message; either feet or meters, depending on which unit you are more comfortable working with

Solution:

###
# Compute the area of a room
###

# Read the input values from the user

length = float(input("Enter the lenght of the room in meter: "))
width = float(input("Enter the width of the room in meter: "))

# Compute the area of the room

area = length * width

# Display the result

print("The are of the room is: ", area, "meter")
Written on January 4, 2018