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!
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.
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.
(The answers are down in the final section of this post.)
and
or or
?import this
prints to the screen?MP3
MIDI
WAV
CSV
XLS
XDR
id()
really
return in CPython?*
~
?
is NOT
special to glob.glob()
?//
division operator?bool()
?diff
make
m4
EncodingError
LookupError
ReferenceError
range()
built-in
What was it called in Python 2?zip()
built-in
What was it called in Python 2?pathlib
module?rm
wc
which
and
operator.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.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!~
character!
— (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.$
— (from six teams)?
— (from ten teams)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).@
character