- There will be 5 rounds
- Each round has one question of each of the next categories:
- What's the output of the script?
**consider the latest version of CPython and libraries**

- PyData community
- Which library is it?
- Monty Python
- Python version
- Barcelona

- What's the output of the script?
- For each answer write:
- The round
- The question
- In the format R1Q1

- You
can't check your phones, tablets, laptops... during the rounds

- At the end of each round, we'll give the answers
- Give your paper with the answers to the team next to you
- Write in red the points:
**0**for wrong answers**1**for right answers**3**for*exceptionally*good answers (we'll let you know)

- At the end, add up all the answers, and report the total

```
>>> first, *middle, last = range(10)
>>> other = [last] * 8
>>> sum(zip(middle, other), tuple())[::2]
```

Who is the creator of Pandas, and author of the book *Python for Data Analysis*?

```
>>> import who_am_i as wai
>>> import numpy as np
>>>
>>> t = np.arange(0.0, 2.0, 0.01)
>>> s = 1 + np.sin(2 * np.pi * t)
>>> wai.plot(t, s)
>>> wai.xlabel('Some numbers')
>>> wai.ylabel('Sine')
>>> wai.title('Sine of some numbers')
>>> wai.grid(True)
>>> wai.show()
```

From which Monty Python movie is this frame?

Since which version of Python this is valid Python code?

```
>>> earth_radius = 6_371
>>> print(f'The radius of earth is {earth_radius}')
```

How many meetups, the Barcelona Python Meetup has held until today?

```
>>> first, *middle, last = range(10)
>>> other = [2] * 8
>>> sum(zip(middle, other), tuple())[::2]
```

```
>>> first, *middle, last = range(10)
>>> first
0
>>> middle
[1, 2, 3, 4, 5, 6, 7, 8]
>>> last
9
>>> other = [last] * 8
>>> other
[9, 9, 9, 9, 9, 9, 9, 9]
>>> zip_val = list(zip(middle, other))
>>> zip_val
[(1, 9), (2, 9), (3, 9), (4, 9), (5, 9), (6, 9), (7, 9), (8, 9)]
>>> sum_val = sum(zip_val, tuple())
>>> sum_val
(1, 9, 2, 9, 3, 9, 4, 9, 5, 9, 6, 9, 7, 9, 8, 9)
>>> sum_val[::2]
(1, 2, 3, 4, 5, 6, 7, 8)
>>> sum(zip(middle, other), tuple())[::2]
(1, 2, 3, 4, 5, 6, 7, 8)
```

Who is the creator of Pandas, and author of the book *Python for Data Analysis*?

```
>>> import who_am_i as wai
>>> import numpy as np
>>>
>>> t = np.arange(0.0, 2.0, 0.01)
>>> s = 1 + np.sin(2 * np.pi * t)
>>> wai.plot(t, s)
>>> wai.xlabel('Some numbers')
>>> wai.ylabel('Sine')
>>> wai.title('Sine of some numbers')
>>> wai.grid(True)
>>> wai.show()
```

```
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>>
>>> t = np.arange(0.0, 2.0, 0.01)
>>> s = 1 + np.sin(2 * np.pi * t)
>>> plt.plot(t, s)
>>> plt.xlabel('Some numbers')
>>> plt.ylabel('Sine')
>>> plt.title('Sine of some numbers')
>>> plt.grid(True)
>>> plt.show()
```

From which Monty Python movie is this frame?

Since which version of Python this is valid Python code?

```
>>> earth_radius = 6_371
>>> print(f'The radius of earth is {earth_radius}')
```

Returns 'The radius of earth is 6371' in Python 3.6, and SyntaxError in all previous version, because of the underscore in the number literal, and the f-string.

How many meetups, the Barcelona Python Meetup has held until today?

```
In [7]:
```import itertools
import random
import bisect
candidates = [0, 99, 666, 22]
weights = [.33, .33, 99., .34]
cum_weights = itertools.accumulate(weights)
candidates[bisect.bisect(cum_weights, random.random() * cum_weights[-1])]

```
```

```
>>> import itertools
>>> import random
>>> import bisect
>>>
>>> candidates = [0, 99, 666, 22]
>>> weights = [.33, .33, 99., .34]
>>> cum_weights = itertools.accumulate(weights)
>>> candidates[bisect.bisect(cum_weights, random.random() * cum_weights[-1])]
```

Which of these projects is **not** a NumFOCUS fiscally sponsored project?

```
>>> import who_am_i as wai
>>> import numpy as np
>>> from sklearn.pipeline import make_pipeline
>>> from sklearn.dummy import DummyClassifier
>>>
>>> X = np.array([[ 1., -1., 2.],
... [ 2., np.nan, 0.],
... [ 0., 1., -1.]])
>>> y = np.array([0., 1., 0.])
>>>
>>> clf = make_pipeline(wai.Imputer(),
... wai.StandardScaler(),
... DummyClassifier())
>>>
>>> clf.fit(X, y)
>>> clf.predict(np.array([[2., 0., -1.]]))
```

Which is the biggest enemy of the *People's Front of Judea*?

Which is the latest released version of Pandas?

Who was the founder of the Barcelona Python Meetup?

```
>>> import itertools
>>> import random
>>> import bisect
>>>
>>> candidates = [0, 99, 666, 22]
>>> weights = [.33, .33, 99., .34]
>>> cum_weights = list(itertools.accumulate(weights))
>>> cum_weights
[0.33, 0.66, 99.66, 100.0]
>>> random_number = random.random() * cum_weights[-1]
>>> # uniformly distributed between 0 and 100
>>> # 99% probability of being between 0.66 and 99.66
>>> random_number
58.95397201789591
>>> index = bisect.bisect(cum_weights, random_number)
>>> index
2
>>> candidates[index]
666
```

```
>>> import itertools
>>> import random
>>> import bisect
>>>
>>> candidates = [0, 99, 666, 22]
>>> weights = [.33, .33, 99., .34]
>>> cum_weights = itertools.accumulate(weights)
>>> candidates[bisect.bisect(cum_weights, random.random() * cum_weights[-1])]
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-7-76cc035203d4> in <module>()
6 weights = [.33, .33, 99., .34]
7 cum_weights = itertools.accumulate(weights)
----> 8 candidates[bisect.bisect(cum_weights, random.random() * cum_weights[-1])]
TypeError: 'itertools.accumulate' object is not subscriptable
```

Which of these projects is **not** a NumFOCUS fiscally sponsored project?

Which of these projects is **not** a NumFOCUS fiscally sponsored project?

```
>>> import who_am_i as wai
>>> import numpy as np
>>> from sklearn.pipeline import make_pipeline
>>> from sklearn.dummy import DummyClassifier
>>>
>>> X = np.array([[ 1., -1., 2.],
... [ 2., np.nan, 0.],
... [ 0., 1., -1.]])
>>> y = np.array([0., 1., 0.])
>>>
>>> clf = make_pipeline(wai.Imputer(),
... wai.StandardScaler(),
... DummyClassifier())
>>>
>>> clf.fit(X, y)
>>> clf.predict(np.array([[2., 0., -1.]]))
```

```
>>> import sklearn.preprocessing
>>> import numpy as np
>>> from sklearn.pipeline import make_pipeline
>>> from sklearn.dummy import DummyClassifier
>>>
>>> X = np.array([[ 1., -1., 2.],
... [ 2., np.nan, 0.],
... [ 0., 1., -1.]])
>>> y = np.array([0., 1., 0.])
>>>
>>> clf = make_pipeline(sklearn.preprocessing.Imputer(),
... sklearn.preprocessing.StandardScaler(),
... DummyClassifier())
>>>
>>> clf.fit(X, y)
>>> clf.predict(np.array([[2., 0., -1.]]))
array([ 1.])
```

Which is the biggest enemy of the *People's Front of Judea*?

Which is the latest released version of Pandas?

Who was the founder of the Barcelona Python Meetup?

```
In [ ]:
```