Skip to content

Instantly share code, notes, and snippets.

@jasonburk
Created July 22, 2012 05:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonburk/3158546 to your computer and use it in GitHub Desktop.
Save jasonburk/3158546 to your computer and use it in GitHub Desktop.
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