by Brandon Rhodes • Home

The First-Ever PyCon Trivia Night

Date: 29 April 2014
Tags:python

PyCon seems to find new ways of fostering community single every year. This year’s conference in Montréal featured the début of official Friday night dinners which I first learned about from a surprising email entitled Want to MC a trivia night at the PyCon dinner?

I accepted the invitation!

While I have enjoyed other volunteer roles at PyCon, this one was particularly exciting because of the difference that official evening activities can make for newcomers. Remembering my own first conferences, it can be stressful to face that lonely moment when the evening lightning talks have just finished. Everyone else seems to pair up and make dinner plans so quickly. Unless you can somehow involve yourself in someone else’s dinner plans, you picture a long walk back to your hotel to order room service — alone — while everyone else sits at candlelit tables in real restaurants talking and laughing and enjoying Québécois cuisine. I hope that my dinner, plus the one hosted by Greg Brockman, provided a few people with a safe default option who otherwise might have had to fend for themselves.

It took hours to research and develop the trivia questions, but everying else was taken care of — Julia Evans (@b0rk), who invited me to host the dinner, made sure that I arrived at the venue and had plenty of time to set up and prepare. Kamal Marhubi (@kmrhb) formatted and printed the answer sheets with only hours remaining before the dinner itself. The only last-minute surprise was that the venue had set up a projector, so I spent the last minutes before dinner re-formatting my questions as slides so that they would be seen as well as heard.

.@brandon_rhodes trivia at #pycon dinner pic.twitter.com/JLHMAGaWV5

— Juan Riaza (@juanriaza) April 11, 2014

And so I found myself in front of a crowd at the Place d'Armes Hotel and it was show time!

A Worrying Round 1

My goal had been for every round to feature some very easy questions — so that even a table of non-programmers might know at least a few answers — alongside more difficult challenges, since I knew that core developers might decide to attend the dinner. (And several did!) But as the answer sheets from the first round streamed in, it was clear that I had badly misjudged its difficulty level. I had created a catastrophic multi-team pile-up tie for 1st place! Take a look:

Download as an IPython Notebook

%pylab inline
import pandas as pd
from io import StringIO

rcParams['savefig.dpi'] = 120

scores_csv = StringIO(u'''\
team,Round 1,Round 2,Round 3
42 Snakes in a Ramen Bowl,9,5,8
A9,10,5,7
Bicycle Repairpersons,10,7,8
Brandon Rhodes,8,6,6
Cayci and the Bikesheds,10,8,9
Dead Parrot Society,9,5,5
Dinosaurs & An Idiot,10,7,7
Dogeneers,10,6,6
Godzilla Ponies,10,6,8
Head of the Class,10,7,7
Raymond Luxury Yacht,10,6,7
Robert'); DROP TABLE Answers; --,9,7,8
Seven bikers,8,6,5
Snakes and Gravy,10,7,9
Stockholm Syndrome,10,6,8.5
The Dead Parrots,10,6,8
The Verloren Monton,10,7,9
The Team Currently in Second Place,10,8,8
__dunderscores__,10,7,7
ಠ_ಠ,10,6,9
''')
df = pd.read_csv(scores_csv).set_index('team')
Populating the interactive namespace from numpy and matplotlib

Yes, there was indeed a team named “Brandon Rhodes” — as well as one absuing the Unicode KANNADA LETTER TTHA to create a cartoon face. And a team named after little bobby tables. Hilarity all around. Thankfully both the IPython Notebook in which I am writing this blog post and the Pandas library behind it are fully Unicode clean, so we should have no trouble determining where things stood at the end of Round 1:

print('Total number of teams:', len(df))
print('Perfect Round 1 scores:', (df['Round 1'] == 10.0).sum())
Total number of teams: 20
Perfect Round 1 scores: 15

Wow — 15 perfect scores creating a 15-way tie for first place! The trivia night looked doomed. Even assuming that a few mistakes would be made in the other two rounds, I imagined having to announce at least a 10-way tie for first place as the result of the first-ever PyCon trivia dinner.

Happily, disaster was averted.

And the winner is

It was the second round that saved the entire evening. It made a perfect score impossible for even the most core-dev-heavy team, and began creating a significant spread among the top teams. One team’s Round 2 answer sheet even featured streaks of moisture at the bottom. “These,” the woman who handed it in announced, “are our tears.”

The trivia night was going well.

m = df.mean().T
lower = df.min().T
upper = df.max().T
x = arange(len(m)) + 1.0

errorbar(x, m, yerr=(m - lower, upper - m), lw=2,
         linestyle='', marker='o')
title('Range and mean of scores'); ylabel('Score')
xticks(x, m.index); yticks(arange(1, 11, 1.0)); grid(axis='y')
xlim(0.5, 3.5); ylim(0, 11)
for xi, mi, li, ui in zip(x, m, lower, upper):
    annotate(str(mi), (xi + 0.05, mi), va='center')

Only as Round 2 was concluding did it occur to me to have each team’s runner simply pick up a blank Round 3 sheet as they turned in their answer sheet for Round 2, saving me from having to hand out the sheets as a separate step.

When the final round was complete, the attendees at my table helped me collate each team’s answer sheets and compute the totals. Here they are, updated after making all of the adjustments mentioned at the bottom of this post in the descriptions of each question and answer:

df.sum(axis=1).order(['total'], ascending=False)
team
Cayci and the Bikesheds               27.0
The Team Currently in Second Place    26.0
The Verloren Monton                   26.0
Snakes and Gravy                      26.0
ಠ_ಠ                                   25.0
Bicycle Repairpersons                 25.0
Stockholm Syndrome                    24.5
__dunderscores__                      24.0
The Dead Parrots                      24.0
Robert'); DROP TABLE Answers; --      24.0
Head of the Class                     24.0
Godzilla Ponies                       24.0
Dinosaurs & An Idiot                  24.0
Raymond Luxury Yacht                  23.0
Dogeneers                             22.0
A9                                    22.0
42 Snakes in a Ramen Bowl             22.0
Brandon Rhodes                        20.0
Seven bikers                          19.0
Dead Parrot Society                   19.0
dtype: float64

Congratulations, Cayci and the Bikesheds! I was very pleased that there was no tie for first place. It is always fun, after listing the second-place teams, to be able to announce a single winner to the crowd. And it was satisfying that the final round’s questions did finally knock “The Team Currently in Second Place” out of the running for 1st.

Thanks again to everyone who supported, attended, and enjoyed the first annual PyCon trivia dinner! I hereby make the official list of questions public, and provide them with comments below.

Trivia Questions

(The answers are down in the final section of this post.)

Round 1

  1. After whom is the Python language named?
  2. Do short-circuiting operators evaluate their left or right subexpression first?
  3. Name four numeric types supported by Python.
  4. Which Python web framework was released first: Flask, CherryPy, or Django?
  5. Which operator has higher precedence: and or or?
  6. What is the name of the poem that import this prints to the screen?
  7. Which file format is supported in the Standard Library: MP3 MIDI WAV
  8. Which file format is NOT supported in the Standard Library? CSV XLS XDR
  9. What does id() really return in CPython?
  10. “Simple is better than what?”

Round 2

  1. Which Standard Library module is named after a member of Monty Python?
  2. Which character * ~ ? is NOT special to glob.glob()?
  3. Which double-underscore method overrides the // division operator?
  4. Which function in the operator module is the equivalent of calling bool()?
  5. Which Python builtin, given a complex number, returns that number’s distance from the origin?
  6. Name a piece of ASCII punctuation that is always a syntax error in both Python 2 and Python 3, through 3.5.
  7. Which shell command equivalent is in the Standard Library: diff make m4
  8. Which is NOT in the Standard Library? EncodingError LookupError ReferenceError
  9. On a 64-bit machine, how many bytes does a CPython integer object occupy?
  10. Errors should never pass what?

Round 3

  1. What was Python 3 originally named after?
  2. Python 3 has a range() built-in What was it called in Python 2?
  3. Python 3 has a zip() built-in What was it called in Python 2?
  4. What operator concatenates a directory name with a file name in the new pathlib module?
  5. How many modules do Python 2.7 and Python 3.2+ offer for command-line argument parsing?
  6. What new infix operator will be added to Python 3.5?
  7. Which one of these three programming languages has adopted Python’s timsort? C# Java Ruby
  8. Which one of these three shell commands does NOT have a Standard Library equivalent? rm wc which
  9. Which integers does CPython pre-allocate in memory?
  10. “There should be one — and preferably only one — obvious way to do it. Although that way may not be obvious at first unless you’re what?”

And, the Answers

Round 1

  1. The Monty Python comedy troupe.
  2. Left.
  3. int float complex Decimal Fraction and some teams even suggested long.
  4. CherryPy.
  5. the and operator.
    You can always remember this by thinking of and and or as being the Boolean versions of multiplication and addition. Try multiplying the two numbers 0 and 1, and then adding them. You will see that multiplication needs both arguments to be 1 to return a 1 and is therefore and, while addition needs only one argument to be 1 for the answer to be nonzero and is therefore the or equivalent. Since multiplication binds more tightly than addition in normal math, you will remember that and binds more tightly than or does.
  6. The Zen of Python.
  7. WAV
  8. XLS
  9. The object’s memory address.
  10. complex.

Round 2

  1. idlelib
    When grading this question at the actual dinner, I awarded only ½ point for the answer idle since my intention was for them to name the top-level package, not a submodule. But upon re-reading my own question today, it is clear that idle also fits the question perfectly. So all teams that said idle have received full credit!
  2. The ~ character
  3. floordiv()
  4. truth()
  5. abs()
  6. I was careful to clarify that the question was about punctuation outside of string literals. The wrong answers that I received were:
    ! — (from two teams) But this character can in fact appear in a Python program without causing an error, if it is part of the != operator.
    ` — (from one team) But the back-tick was, crazily enough, valid in Python 2 because you could surround an expression with back-ticks in order to generate its repr().
    ^ — (from one team) this is Python’s XOR bitwise binary operator.
    There are at least two possible correct answers:
    \( — (from six teams)
    ? — (from ten teams)
  7. diff
  8. EncodingError
  9. 24
    Larry Hastings contests this in the specific case of Python 3, where even small integers have lengths even greater than 24 bytes. (His team put down 24 as their answer anyway, knowing that it was the answer I wanted.) But I have heard a rumor that even under Python 3 the integer zero is stored in only 24 bytes — making the answer correct for at least one possible integer!
  10. Silently

Round 3

  1. MST3k
    Although I was expecting the answer to be simply Mystery Science Theater 3000 it turns out that the name probably started as a parody of “Windows 2000” instead, as Larry Hastings pointed out to me immediately afterward. But since Guido mentions both possible sources on the Python web site, I am now accepting either answer as correct: https://www.python.org/doc/essays/foreword2/
  2. xrange()
  3. itertools.izip()
  4. /
  5. 3
    I was thinking of getopt, optparse, and argparse but I accepted larger answers than “three” because several teams documented further ideas about where you could get arguments parsed in the Standard Library, including shlex (mentioned by two teams) and distutils.fancy_getopt (mentioned only by Cayci and the Bikesheds).
  6. Matrix multiply using the rather unobvious @ character
  7. Java (SE 7)
  8. wc
  9. integers –5 through 256
  10. Dutch
comments powered by Disqus

©2014