In [1]:
import math
import random; random.seed(0)
from collections import Counter
from itertools import chain
ATTENDEES = 17000
eligible_users = []  # we will add a list of packs to this whenever we find someone who's eligible

First I'm going to define a function which gets us an attendee's spending at random. Don't worry about the implementation, just check the printed sample of 100 values generated and see if it seems realistic. I think it is, but we can argue about this, sure.

You can adjust the algorithm and see the numbers with what you feel is a realistic distribution.


In [2]:
def get_spending_of_attendee():
    if random.random() < 0.03:  # Let's say 3% doesn't even care about the secret shop
        return 0

    return int((random.paretovariate(2) - 0.5) * 100)

print([get_spending_of_attendee() for _ in range(100)])


[153, 66, 79, 69, 104, 92, 152, 65, 712, 269, 142, 127, 55, 110, 497, 222, 176, 50, 78, 123, 0, 224, 71, 61, 64, 175, 54, 92, 55, 134, 182, 475, 105, 107, 103, 61, 110, 88, 153, 311, 263, 97, 134, 180, 258, 396, 84, 1584, 169, 110, 114, 64, 56, 170, 183, 58, 52, 283, 126, 0, 109, 78, 666, 51, 60, 62, 348, 0, 55, 63, 74, 91, 55, 61, 143, 300, 124, 53, 204, 65, 83, 87, 102, 70, 198, 100, 0, 72, 67, 411, 68, 383, 112, 77, 119, 0, 72, 116, 233, 80]

Packs are identified by an ID of 0 to 5, and this function just hands out an attendee's packs based on their spending.


In [3]:
def get_packs(spending):
    return [random.randint(0, 5) for _ in range(math.floor(spending / 50))]

So here's the meat of the notebook. We get a random spending, the packs for that, and try to redeem the stickers for the digital unlock. If we can't do that because of dupes, we increment our userbase by one. If someone is not constrained by dupes, they have no use for our site. This includes:

  • People who have less than 6 stickers in total
  • People who were lucky enough to be able complete to complete their book on their own

In [4]:
for _ in range(ATTENDEES):
    spending = get_spending_of_attendee()
    packs = get_packs(spending)
    try:
        while len(packs) > 5:
            for pack_id in range(6):
                packs.remove(pack_id)
    except ValueError:
        eligible_users.append(packs)

In [5]:
print(len(eligible_users))


1280

So, yeah. We have around 1,280 people who could even use the site. But:

  • We can't let all of them know that the site exists.
  • Since there's lots of people coming from abroad, most won't even have convenient Internet access.
  • Not all of them are going to bother (some of them already have one unlock redeemed).
  • If they are a group of friends they can possibly solve the issue without us.

After all this, we're lucky to have say, a userbase of 500.

However:


In [6]:
pack_count = sum(len(get_packs(get_spending_of_attendee())) for _ in range(ATTENDEES))
print(pack_count)


42241

There's 42,000 packs handed out, most of which go unredeemed. That'd be 7,000 completed sticker books if we could match them all up, not 1,280.