Pizza.py

Wednesday 10 October 2012This is 12 years old. Be careful.

I’ve been organizing the Boston Python user group for a few years now, and I like it a lot. Except for ordering pizza. But finally I’ve brought some technology to bear on the problem!

First, I’ve taken a poll of people RSVP’ing for tonight’s project night, so I now have an empirical basis for deciding what fraction of the pizzas should be meat, vegetable, cheese, or vegan. Surprise (to me): vegetable wins.

Second, I’ve written what may be the world’s most useful Python program: pizza.py!

"""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)

The hard truth here is the Meetup Universal Constant. The MUC has been empirically determined, and says that no matter how much you wheedle people to show up if they say they will, and vice-versa, about one-third of the RSVPs will not attend. This number has proven remarkably stable over the 25 or so events that we’ve measured.

As an example, for tonight’s event, we have 127 RSVPs:

How many RSVPs? 127

82 people will show up (guess)
25.8 pizzas (or so)

 6 cheese
 8 meat
11 veggie
 1 vegan

26 total

Your numbers may vary. Perhaps Boston is a vegetarian hotbed compared to where you are. Maybe your city has more-predictable weather and fewer people abandon their intention to attend. Tweak pizza.py as you see fit!

Comments

[gravatar]
Pizza isn't usually as much of a problem for me as drinks. Even after organizing two years of GRWebDev meetings (35-90 attendees), I can never seem to get right mix of diet/regular caf/decaf pop/juices right. Thanks for giving me some more ideas for figuring this out scientifically.
[gravatar]
I've got a pizza.py as well, so this caught my attention. In my case, it's used to process a CSV file exported from a spreadsheet used for raw data entry. The data comes from paper (for now) forms that parents fill in bi-monthly to order pizza, drinks, and snacks for a weekly "Pizza Day" at our daughter's public school. The script generates a PDF with one page per class per week, showing what each kid gets, plus weekly ordering totals for the organizers. One Python script is saving about 50 hours per year of extra work compared to how they used to do it...

The other neat thing is that "pizza.py" is the best file name EVER! ;-)
[gravatar]
According to economics, since the effect of using pizza.py will tend to satisfy more people, the MUC "constant" will tend to increase as well :-)
[gravatar]
I'm curious about the format of the survey that determined the ratios. There is this interesting effect that while most vegetarian fans won't touch a meat pizza most meat fans will eat vegetarian.
We have problems with groups with a small fraction of vegetarians where we had enough vegetarian pizza for them but others ate it.
[gravatar]
Tolomea: you must have different meat eaters than I've seen. In my experience, the meat eaters won't touch the vegetarian pizzas. "Broccoli and what? Nah, I'll just get something later."

What always always always happens at work is that the leftover pizzas are the vegetarian ones (or otherwise "weird" choices). The meat pizzas generally going in the blink of an eye, maybe because the meat eaters instinctively realize they have to grab as much as they can before it runs out.

I would err towards more meat pizzas, more cheese pizzas, and fewer vegetarian.
[gravatar]
I guess this means that gluten-free python hackers are not statistically significant?
[gravatar]
1. If it doesn't also use web apis to order the pizza, what's the point?

2. No Kevin, gluten-free (or any other actual allergy) is never statistically significant. . .Until they make enough noise to be noticed.
[gravatar]
I err towards more vegetarian than meat. I've run one python workshop here (Chicago) so far, and I ordered kabobs for that one instead of pizzas. All the veggie kabobs were gone by the end of the day, and there were still meat kabobs left over. Everyone reported being very happy with the food.
[gravatar]
@Nate Reading the words 'work', 'leftover', 'pizza' caused me to salivate.

I wonder whether grasping carnivores and laid back vegetarian grazers are differently evolved. The omnivores are the ones to fear, though. They'll eat you or your food source.

Add a comment:

Ignore this:
Leave this empty:
Name is required. Either email or web are required. Email won't be displayed and I won't spam you. Your web site won't be indexed by search engines.
Don't put anything here:
Leave this empty:
Comment text is Markdown.