Skip to content
Snippets Groups Projects
QUIZ_leaderboard.ipynb 4.82 KiB
Newer Older
  • Learn to ignore specific revisions
  • {
     "cells": [
      {
       "cell_type": "markdown",
       "id": "608c7b2a",
       "metadata": {},
       "source": [
        "# LEADERBOARD"
       ]
      },
      {
       "cell_type": "code",
    
       "execution_count": 4,
    
       "id": "e5396acf",
       "metadata": {},
       "outputs": [
        {
         "name": "stdout",
         "output_type": "stream",
         "text": [
    
          "                 w1     w2     w3     w4     w5    \n",
          "                  1 2 3  1 2 3  1 2 3  1 2 3  1 2 3\n",
          "         Jojo 15  ✓ ✓ ✓  ✓ ✓ ✓  ✓ ✓ ✓  ✓ ✓ ✓  ✓ ✓ ✓\n",
          "     PaulineS 14  ✓ ✓ ✓  ✓ ✓ ✓  ✓ ✓ ✓  ✓ ✓ ✓  ✗ ✓ ✓\n",
          "        David 13  ✓ ✓ ✓  ✓ ✗ ✓  ✓ ✓ ✓  ✗ ✓ ✓  ✓ ✓ ✓\n",
          "      AndrewK 12  ✗ ✓ ✓  ✗ ✓ ✓  ✓ ✓ ✓  ✓ ✓ ✓  ✗ ✓ ✓\n",
          " LeventeBuzga 12  ✓ ✓ ✓  ✓ ✓ ✓  - - -  ✓ ✓ ✓  ✓ ✓ ✓\n",
          "  SportySpice 11  ✓ ✓ ✗  ✗ ✗ ✗  ✓ ✓ ✓  ✓ ✓ ✓  ✓ ✓ ✓\n",
          "Luca Saladino 11  ✓ ✓ ✓  - - -  ✓ ✗ ✓  ✓ ✓ ✓  ✓ ✓ ✓\n",
          "     johnslim 11  ✗ ✓ ✓  - - -  ✓ ✓ ✓  ✓ ✓ ✓  ✓ ✓ ✓\n",
          "          pbn 10  ✓ ✓ ✗  ✗ ✓ ✗  ✗ ✓ ✓  ✗ ✓ ✓  ✓ ✓ ✓\n",
          "           mp 10  ✓ ✓ ✓  - - -  ✗ ✓ ✓  ✗ ✓ ✓  ✓ ✓ ✓\n",
          "        vince  9  ✓ ✓ ✗  ✗ ✗ ✓  ✓ ✓ ✓  ✓ ✓ ✗  ✓ ✗ ✗\n",
          "       Rasmus  9  ✓ ✗ ✗  ✗ ✓ ✓  - - -  ✓ ✓ ✓  ✓ ✓ ✓\n",
          "      Anonyms  7  ✓ ✗ ✗  ✓ ✗ ✓  ✗ ✓ ✓  ✓ ✓ ✗  - - -\n",
          "      Mathias  7  ✓ ✓ ✓  - - -  - - -  ✓ ✓ ✓  ✗ ✓ ✗\n",
          "     andreama  5  ✓ ✗ ✗  ✗ ✗ ✗  ✗ ✗ ✗  ✓ ✓ ✓  ✗ ✓ ✗\n",
          "   kathariner  3  ✗ ✗ ✓  - - -  - - -  ✓ ✓ ✗  - - -\n",
          "         Emil  2  ✓ ✓ ✗  - - -  - - -  - - -  - - -\n",
          "  KnudMondrup  2  ✓ ✓ ✗  - - -  - - -  - - -  - - -\n",
          "       Anna_E  2  ✓ ✗ ✓  - - -  - - -  - - -  - - -\n",
          "   kathariner  2  - - -  - - -  - - -  - - -  ✓ ✓ ✗\n",
          "        JensL  2  ✓ ✓ ✗  - - -  - - -  - - -  - - -\n",
          "     Joakim_P  2  ✓ ✗ ✗  - - -  - - -  - - -  ✗ ✓ ✗\n",
          "        Sofia  1  ✓ ✗ ✗  - - -  - - -  - - -  - - -\n",
          "  JBorregaard  1  ✗ ✓ ✗  - - -  - - -  - - -  - - -\n",
          "Thomas Hornum  1  ✗ ✓ ✗  - - -  - - -  - - -  - - -\n",
          "       snoopy  1  ✓ ✗ ✗  - - -  - - -  - - -  - - -\n",
          "        Ninna  1  ✗ ✗ ✓  - - -  - - -  - - -  - - -\n",
          " GenieVickery  1  ✓ ✗ ✗  - - -  - - -  - - -  - - -\n",
          "        Jerry  1  ✓ ✗ ✗  - - -  - - -  - - -  - - -\n",
          "          JWH  1  ✓ ✗ ✗  - - -  - - -  - - -  - - -\n",
          "     100rocks  0  ✗ ✗ ✗  - - -  - - -  - - -  - - -\n"
    
         ]
        }
       ],
       "source": [
        "import quizzes_helper as qh\n",
    
        "summary = qh.combine_weeks('_SUBMISSIONS/', week_list = [1, 2, 3, 4, 5])\n",
    
        "qh.print_leaderboard(summary)"
       ]
      },
      {
    
       "cell_type": "markdown",
       "id": "ddf7eb78",
    
       "metadata": {},
       "source": [
    
        "# At the end of the course - finding the lucky quiz participant"
    
       "cell_type": "code",
       "execution_count": 16,
       "id": "a0d98b67",
    
       "metadata": {},
    
       "outputs": [],
    
       "source": [
    
        "# qh.plot_overview(summary)"
    
       ]
      },
      {
       "cell_type": "code",
    
       "execution_count": 17,
    
       "id": "65872a3f",
       "metadata": {},
    
       "outputs": [],
    
       "source": [
    
        "# chance = summary[['display name']].copy()\n",
        "# chance[['from', 'to']] = 0\n",
        "# chance['to'] = summary.iloc[:, 2:].notna().sum(axis=1).cumsum()\n",
        "# chance['from'] = chance['to'].shift(1).fillna(0).astype(int) \n",
        "# chance['to'] = chance['to'] - 1\n",
        "# print(chance.to_string(index=False, header=True))"
    
       ]
      },
      {
       "cell_type": "code",
    
       "execution_count": 18,
    
       "id": "4c14c648",
       "metadata": {},
       "outputs": [],
       "source": [
    
        "# import random\n",
        "# import time\n",
        "# random.seed(time.time())\n",
        "# i = random.randint(0, chance['to'][-1])\n",
        "# print(f'Random number is {i}')\n",
        "# winner = (chance['from']<= i) & (chance['to']>= i)\n",
        "# print(f'Lucky quiz participant is {chance[winner][\"display name\"].values[0]}')"
    
       ]
      },
      {
       "cell_type": "code",
       "execution_count": null,
       "id": "feb044aa",
       "metadata": {},
       "outputs": [],
       "source": []
      }
     ],
     "metadata": {
      "kernelspec": {
    
       "display_name": "base",
    
       "language": "python",
       "name": "python3"
      },
      "language_info": {
       "codemirror_mode": {
        "name": "ipython",
        "version": 3
       },
       "file_extension": ".py",
       "mimetype": "text/x-python",
       "name": "python",
       "nbconvert_exporter": "python",
       "pygments_lexer": "ipython3",
    
       "version": "3.9.12"
    
      }
     },
     "nbformat": 4,
     "nbformat_minor": 5
    }