Skip to content

Instantly share code, notes, and snippets.

@knoxilla
Last active December 23, 2015 13:39
Show Gist options
  • Save knoxilla/6643076 to your computer and use it in GitHub Desktop.
Save knoxilla/6643076 to your computer and use it in GitHub Desktop.
"""How many pizzas do we need?"""
import math
import sys
if len(sys.argv) > 1:
people = int(sys.argv[1])
else:
people = int(raw_input("How many RSVPs? "))
# The MUC (Meetup Universal Constant)
attending = people * .65
print
print "%d people will show up (guess)" % attending
# Appetite estimation
slices = attending * 2.5
# Basic pizza geometry
pies = slices / 8
print "%.1f pizzas (or so)" % pies
# From answers to the 10/2012 project night:
# 81 answers
# 26 meat 32%
# 37 veg 45%
# 16 cheese 20%
# 2 vegan 3%
vegan = int(.03 * pies) or 1
meat = int(.33 * pies) or 1
veg = int(.45 * pies) or 1
cheese = pies - vegan - meat - veg
if cheese < 1:
cheese = 1
cheese = int(math.ceil(cheese))
print
print "%2d cheese" % cheese
print "%2d meat" % meat
print "%2d veggie" % veg
print "%2d vegan" % vegan
print
print "%2d total" % (cheese + meat + veg + vegan)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment