Skip to content
Snippets Groups Projects
Commit 7ab0727d authored by Vedrana Andersen Dahl's avatar Vedrana Andersen Dahl
Browse files

Update QUIZ_leaderboard.ipynb

parent 11602647
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id:608c7b2a tags:
# LEADERBOARD
%% Cell type:code id:e5396acf tags:
``` python
import quizzes_helper as qh
summary = qh.combine_weeks('_SUBMISSIONS/', week_list = [1, 2, 3, 4, 5, 6, 7, 8, 10])
summary = qh.combine_weeks('_SUBMISSIONS/', week_list = [1, 2])
qh.print_leaderboard(summary)
```
%% Output
w1 w2 w3 w4 w5 w6 w7 w8 w9
1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
NielsPeter 27 ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
Caroline 26 ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
Ingi 26 ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
Ida Puggaard 25 ✓ ✓ ✓ ✓ ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
J5gbqp 24 ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✗
HannahNielsen 23 ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✗ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✗ ✓
AstridVesterbrandt 21 ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✗ ✗ ✓ ✓ ✓ ✗ ✓ ✗ ✓ ✗ ✓
Olczixo 19 ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✗ ✓ ✓ ✓ ✓ ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓
s184009 18 ✓ ✗ ✗ ✓ ✗ ✓ ✓ ✓ ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✗ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✗ ✗ ✗
ET_Phone_Home 16 ✓ ✓ ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✗ ✗ ✓ ✓ ✓ ✓ - - - - - - ✓ ✓ ✓ ✓ ✗ ✗
RSM 16 ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✗ ✓ ✓ ✗ ✗ ✗ - - - ✓ ✗ ✗ ✓ ✓ ✗ ✓ ✓ ✓
JuliusKokholm 15 ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✗ ✓ ✗ ✓ ✓ ✓ - - - - - - - - -
HelenaJensen 15 ✓ ✓ ✗ ✓ ✗ ✓ ✓ ✗ ✗ ✗ ✓ ✓ ✗ ✓ ✓ ✗ ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✗ - - -
jsimonsen 14 ✓ ✓ ✓ - - - - - - ✓ ✓ ✓ ✓ ✓ ✓ ✗ ✓ ✓ - - - - - - ✓ ✓ ✓
Delfin 14 ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✗ ✓ ✓ ✓ ✗ ✗ ✗ ✓ ✓ ✓ - - - - - - ✗ ✗ ✗
SeverinH 14 ✓ ✓ ✓ ✗ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✗ ✓ ✗ ✓ ✓ ✓ - - - - - - - - -
askefandersen 13 ✓ ✗ ✓ ✓ ✓ ✓ ✗ ✓ ✗ ✓ ✗ ✓ ✗ ✗ ✗ ✗ ✓ ✓ ✓ ✓ ✓ ✗ ✗ ✗ ✗ ✗ ✗
CassandraD 13 ✓ ✓ ✓ ✓ ✓ ✓ - - - ✗ ✓ ✓ ✗ ✓ ✓ - - - ✓ ✓ ✓ - - - - - -
Nojus 10 ✗ ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ - - - - - - - - - - - - - - -
Denitsa 10 ✓ ✗ ✗ ✓ ✓ ✗ ✓ ✓ ✗ ✗ ✓ ✓ ✗ ✗ ✓ ✗ ✗ ✗ ✓ ✗ ✗ - - - ✗ ✓ ✗
ViktorIsaksen 8 ✓ ✓ ✓ - - - - - - ✗ ✓ ✗ ✓ ✗ ✗ - - - ✓ ✓ ✓ ✗ ✗ ✗ ✗ ✗ ✗
chuan kuang 8 ✗ ✗ ✗ - - - - - - - - - - - - ✓ ✓ ✓ - - - ✓ ✓ ✓ ✓ ✗ ✓
Anonymous_Duck 8 ✓ ✗ ✓ ✓ ✓ ✓ ✗ ✗ ✗ - - - ✓ ✓ ✓ - - - - - - - - - - - -
ngre98 7 ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✗ ✓ - - - - - - - - - - - - - - - - - -
jkb 6 - - - - - - ✓ ✓ ✗ - - - ✗ ✓ ✗ ✗ ✓ ✗ ✓ ✓ ✗ - - - - - -
RyanWasHere 5 ✓ ✗ ✗ - - - - - - - - - - - - - - - - - - ✓ ✓ ✗ ✓ ✗ ✓
EmilRamovic 5 ✗ ✓ ✗ ✓ ✓ ✗ ✗ ✓ ✓ - - - - - - - - - - - - - - - - - -
Louis Kamp 5 ✓ ✓ ✓ ✓ ✗ ✓ - - - - - - - - - - - - - - - - - - - - -
Rami 3 - - - - - - - - - ✓ ✓ ✓ - - - - - - - - - - - - - - -
mbk 3 ✓ ✓ ✓ - - - - - - - - - - - - - - - - - - - - - - - -
Gruny 3 ✓ ✓ ✓ - - - - - - - - - - - - - - - - - - - - - - - -
MihaiA 3 ✓ ✓ ✓ - - - - - - - - - - - - - - - - - - - - - - - -
Tols 3 ✓ ✓ ✓ - - - - - - - - - - - - - - - - - - - - - - - -
DavidOstenfeldt 2 ✓ ✗ ✓ - - - - - - - - - - - - - - - - - - - - - - - -
Peter Jensen 2 ✓ ✗ ✓ - - - - - - - - - - - - - - - - - - - - - - - -
Morten Christensen 2 ✓ ✗ ✓ - - - - - - - - - - - - - - - - - - - - - - - -
ChristianOle 2 ✓ ✗ ✓ - - - - - - - - - - - - - - - - - - - - - - - -
VeloPlusPlus 2 ✓ ✗ ✓ - - - - - - - - - - - - - - - - - - - - - - - -
Watermelon 2 ✓ ✓ ✗ - - - - - - - - - - - - - - - - - - - - - - - -
HelloFromCanada 2 ✓ ✓ ✗ - - - - - - - - - - - - - - - - - - - - - - - -
Leonardo Rodovero 1 ✓ ✗ ✗ - - - - - - - - - - - - - - - - - - - - - - - -
SophusBarlebo 1 ✓ ✗ ✗ - - - - - - - - - - - - - - - - - - - - - - - -
oliverHagel 1 ✓ ✗ ✗ - - - - - - - - - - - - - - - - - - - - - - - -
Rose 0 ✗ ✗ ✗ - - - - - - - - - - - - - - - - - - - - - - - -
Michalina 0 ✗ ✗ ✗ - - - - - - - - - - - - - - - - - - - - - - - -
w1 w2
1 2 3 1 2 3
LeventeBuzga 6 ✓ ✓ ✓ ✓ ✓ ✓
PaulineS 6 ✓ ✓ ✓ ✓ ✓ ✓
Jojo 6 ✓ ✓ ✓ ✓ ✓ ✓
David 5 ✓ ✓ ✓ ✓ ✗ ✓
AndrewK 4 ✗ ✓ ✓ ✗ ✓ ✓
Anonyms 3 ✓ ✗ ✗ ✓ ✗ ✓
Luca Saladino 3 ✓ ✓ ✓ - - -
vince 3 ✓ ✓ ✗ ✗ ✗ ✓
mp 3 ✓ ✓ ✓ - - -
Rasmus 3 ✓ ✗ ✗ ✗ ✓ ✓
pbn 3 ✓ ✓ ✗ ✗ ✓ ✗
Mathias 3 ✓ ✓ ✓ - - -
KnudMondrup 2 ✓ ✓ ✗ - - -
Emil 2 ✓ ✓ ✗ - - -
Anna_E 2 ✓ ✗ ✓ - - -
SportySpice 2 ✓ ✓ ✗ ✗ ✗ ✗
JensL 2 ✓ ✓ ✗ - - -
johnslim 2 ✗ ✓ ✓ - - -
snoopy 1 ✓ ✗ ✗ - - -
Joakim_P 1 ✓ ✗ ✗ - - -
JBorregaard 1 ✗ ✓ ✗ - - -
Sofia 1 ✓ ✗ ✗ - - -
Thomas Hornum 1 ✗ ✓ ✗ - - -
Ninna 1 ✗ ✗ ✓ - - -
andreama 1 ✓ ✗ ✗ ✗ ✗ ✗
GenieVickery 1 ✓ ✗ ✗ - - -
Jerry 1 ✓ ✗ ✗ - - -
kathariner 1 ✗ ✗ ✓ - - -
JWH 1 ✓ ✗ ✗ - - -
100rocks 0 ✗ ✗ ✗ - - -
%% Cell type:markdown id:ddf7eb78 tags:
# At the end of the course - finding the lucky quiz participant
%% Cell type:code id:a0d98b67 tags:
``` python
qh.plot_overview(summary)
# qh.plot_overview(summary)
```
%% Output
%% Cell type:markdown id:ddf7eb78 tags:
# Finding the lucky quiz participant
%% Cell type:code id:65872a3f tags:
``` python
chance = summary[['display name']].copy()
chance[['from', 'to']] = 0
chance['to'] = summary.iloc[:, 2:].notna().sum(axis=1).cumsum()
chance['from'] = chance['to'].shift(1).fillna(0).astype(int)
chance['to'] = chance['to'] - 1
print(chance.to_string(index=False, header=True))
# chance = summary[['display name']].copy()
# chance[['from', 'to']] = 0
# chance['to'] = summary.iloc[:, 2:].notna().sum(axis=1).cumsum()
# chance['from'] = chance['to'].shift(1).fillna(0).astype(int)
# chance['to'] = chance['to'] - 1
# print(chance.to_string(index=False, header=True))
```
%% Output
display name from to
NielsPeter 0 26
Caroline 27 53
Ingi 54 80
Ida Puggaard 81 107
J5gbqp 108 134
HannahNielsen 135 161
AstridVesterbrandt 162 188
Olczixo 189 215
s184009 216 242
ET_Phone_Home 243 263
RSM 264 287
JuliusKokholm 288 305
HelenaJensen 306 329
jsimonsen 330 344
Delfin 345 365
SeverinH 366 383
askefandersen 384 410
CassandraD 411 425
Nojus 426 437
Denitsa 438 461
ViktorIsaksen 462 479
chuan kuang 480 491
Anonymous_Duck 492 503
ngre98 504 512
jkb 513 524
RyanWasHere 525 533
EmilRamovic 534 542
Louis Kamp 543 548
Rami 549 551
mbk 552 554
Gruny 555 557
MihaiA 558 560
Tols 561 563
DavidOstenfeldt 564 566
Peter Jensen 567 569
Morten Christensen 570 572
ChristianOle 573 575
VeloPlusPlus 576 578
Watermelon 579 581
HelloFromCanada 582 584
Leonardo Rodovero 585 587
SophusBarlebo 588 590
oliverHagel 591 593
Rose 594 596
Michalina 597 599
%% Cell type:code id:4c14c648 tags:
``` python
import random
import time
random.seed(time.time())
i = random.randint(0, chance['to'][-1])
print(f'Random number is {i}')
winner = (chance['from']<= i) & (chance['to']>= i)
print(f'Lucky quiz participant is {chance[winner]["display name"].values[0]}')
# import random
# import time
# random.seed(time.time())
# i = random.randint(0, chance['to'][-1])
# print(f'Random number is {i}')
# winner = (chance['from']<= i) & (chance['to']>= i)
# print(f'Lucky quiz participant is {chance[winner]["display name"].values[0]}')
```
%% Cell type:code id:feb044aa tags:
``` python
```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment