Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Little project I did for a class. Calculates room square footage and cubic footage.
# Jason Burk
# Python Version: 2.73
#
#A program to calculate the square footage of a room, and also the cubic feet if the user desires.
print "****************************\n*** Room Size Calculator ***\n****************************" #Displays welcome message to user
print #blank line
room_width = input("What is the width of your room in feet?\n[Please enter a number] ") #asks user for input of room width
room_depth = input("What is the depth of your room in feet?\n[Please enter a number] ") #asks user for input of room depth
square_footage = room_width * room_depth #calculates the square footage of room
print "Your room is" ,square_footage, "square feet." #displays the square footage to the user
print #blank line
#asks user if they would like to calculate how many cubic feet the room is
cube_calc_q = raw_input("Would you like to calculate how many cubic feet your room is?\n[Please enter 'yes' or 'no'] ")
if cube_calc_q == "yes" or cube_calc_q == "Yes" or cube_calc_q == "YES" or cube_calc_q == "y": #if user types "yes" or "Yes" or "YES" or "y" they will be asked for the height of the room
room_height = input("What is the height of your room in feet?\n[Please enter a number] ") #asks user to enter height of room
cubic_feet = square_footage * room_height #calculates cubic feet of room
print "Your room is" ,cubic_feet, "cubic feet." #displays the cubic feet of room to user
else:
print "Thanks for using the Room Size Calculator!" #prints thank you statement if user types anything other than the above yes answers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.