Skip to content

Instantly share code, notes, and snippets.

@chyyran
Created March 8, 2013 19:04
Show Gist options
  • Save chyyran/5118939 to your computer and use it in GitHub Desktop.
Save chyyran/5118939 to your computer and use it in GitHub Desktop.
calc.
def calc_rectangular_prism(sidea, sideb, sidec,unit="cm"):
volume = sidea*sideb*sidec
area = sidea * sideb + sideb * sidec + sidea * sidec
area = 2 * area
print "a = 2(lw+lh+wh)"
print " = 2(%sx%s+%sx%s+%sx%s)" % (str(sidea),str(sideb),str(sidea),str(sidec),str(sideb),str(sidec))
print " = 2(%s+%s+%s)" % (str(sidea * sideb),str(sidea*sidec),str(sideb*sidec))
print " = 2(%s)" % str(area/2)
print " = %s %s squared" % (str(area),unit)
print "Volume = %s %s cubed" % (str(volume),unit)
print "Area = %s %s squared" % (str(area),unit)
print "Can I please have my food rations now?"
string = raw_input()
if string.lower() == "no":
print "Sorry for bothering you, Glorious Leader"
return
print "I am forever grateful, Glorious Leader"
calc_rectangular_prism(15,12,16)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment