Skip to content

Instantly share code, notes, and snippets.

@MikeTrizna
Created February 12, 2023 21:03
Show Gist options
  • Save MikeTrizna/bde30207f3d40632f9a22ebcddc91b68 to your computer and use it in GitHub Desktop.
Save MikeTrizna/bde30207f3d40632f9a22ebcddc91b68 to your computer and use it in GitHub Desktop.
Super Bowl Squares 2023
0 1 2 3 4 5 6 7 8 9
0 Bill Sule Grandma Andrew Sam Wynn Dad Dad Sam Katie
1 Jessica Sule Natalie Christopher Grandma Jessica Natalie Mom Dad Wynn
2 Natalie Andrew EVERYONE Carla Bill Natalie Grandma Michael Michael Katie
3 Sule Christopher Christopher Andrew Bill Christopher Wynn Katie Mom Bill
4 Jessica Natalie Carla Andrew Lauren Mom Elliott Natalie Michael Lauren
5 Sam Katie Elliott Carla Sam Grandma Grandma Elliott Jessica EVERYONE
6 Elliott Carla Sam Dad Wynn Andrew Carla Katie Wynn Grandma
7 Lauren EVERYONE Wynn Bill Michael Dad Mom Carla Jessica Michael
8 Dad Lauren Michael Bill Lauren Christopher Christopher Elliott Sule Mom
9 Mom Sule Jessica Katie Sule Elliott EVERYONE Andrew Lauren Sam
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Super Bowl 2023 Squares"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"ExecuteTime": {
"end_time": "2021-02-07T15:58:52.298163Z",
"start_time": "2021-02-07T15:58:51.465217Z"
},
"execution": {
"iopub.status.idle": "2023-02-12T20:59:40.937955Z",
"shell.execute_reply": "2023-02-12T20:59:40.937284Z",
"shell.execute_reply.started": "2023-02-12T20:59:28.747339Z"
}
},
"outputs": [],
"source": [
"import random\n",
"import pandas as pd\n",
"import numpy as np"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First, creating the list of players"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"ExecuteTime": {
"end_time": "2021-02-07T15:58:52.302552Z",
"start_time": "2021-02-07T15:58:52.299798Z"
},
"execution": {
"iopub.execute_input": "2023-02-12T20:59:40.939404Z",
"iopub.status.busy": "2023-02-12T20:59:40.938990Z",
"iopub.status.idle": "2023-02-12T20:59:40.945618Z",
"shell.execute_reply": "2023-02-12T20:59:40.944363Z",
"shell.execute_reply.started": "2023-02-12T20:59:40.939321Z"
}
},
"outputs": [],
"source": [
"player_list = ['Dad','Carla',\n",
" 'Mom', 'Bill',\n",
" 'Michael', 'Natalie','Elliott',\n",
" 'Jessica', 'Sam',\n",
" 'Andrew', 'Wynn',\n",
" 'Christopher',\n",
" 'Katie', 'Sule',\n",
" 'Lauren', 'Grandma']"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"There are 16 names in the list. 100 divided by 16 is 6 and a little change. So now we'll make a list with each name duplicated 6 times."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"ExecuteTime": {
"end_time": "2021-02-07T15:58:52.308682Z",
"start_time": "2021-02-07T15:58:52.305065Z"
},
"execution": {
"iopub.execute_input": "2023-02-12T20:59:40.949124Z",
"iopub.status.busy": "2023-02-12T20:59:40.948720Z",
"iopub.status.idle": "2023-02-12T20:59:40.957808Z",
"shell.execute_reply": "2023-02-12T20:59:40.955891Z",
"shell.execute_reply.started": "2023-02-12T20:59:40.949088Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['Dad', 'Dad', 'Dad', 'Dad', 'Dad', 'Dad', 'Carla', 'Carla', 'Carla', 'Carla', 'Carla', 'Carla', 'Mom', 'Mom', 'Mom', 'Mom', 'Mom', 'Mom', 'Bill', 'Bill']\n"
]
}
],
"source": [
"squares_list = [name for name in player_list for _ in range(0,6)]\n",
"print(squares_list[:20])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"After doing this, we've got 98 squares."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"ExecuteTime": {
"end_time": "2021-02-07T15:58:52.318709Z",
"start_time": "2021-02-07T15:58:52.310359Z"
},
"execution": {
"iopub.execute_input": "2023-02-12T20:59:40.960996Z",
"iopub.status.busy": "2023-02-12T20:59:40.960147Z",
"iopub.status.idle": "2023-02-12T20:59:40.979174Z",
"shell.execute_reply": "2023-02-12T20:59:40.978135Z",
"shell.execute_reply.started": "2023-02-12T20:59:40.960907Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"96"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(squares_list)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"98 squares means that 2 will be left blank, so let's just fill those with EVERYONE. Not sure how we'll handle that if one of these squares wins, but we'll deal with that later."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"execution": {
"iopub.execute_input": "2023-02-12T20:59:40.980822Z",
"iopub.status.busy": "2023-02-12T20:59:40.980271Z",
"iopub.status.idle": "2023-02-12T20:59:40.985698Z",
"shell.execute_reply": "2023-02-12T20:59:40.984525Z",
"shell.execute_reply.started": "2023-02-12T20:59:40.980786Z"
}
},
"outputs": [],
"source": [
"fill_in = ['EVERYONE' for i in range(4)]"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"ExecuteTime": {
"end_time": "2021-02-07T15:58:52.327100Z",
"start_time": "2021-02-07T15:58:52.321520Z"
},
"execution": {
"iopub.execute_input": "2023-02-12T20:59:40.987213Z",
"iopub.status.busy": "2023-02-12T20:59:40.986806Z",
"iopub.status.idle": "2023-02-12T20:59:40.992942Z",
"shell.execute_reply": "2023-02-12T20:59:40.992067Z",
"shell.execute_reply.started": "2023-02-12T20:59:40.987183Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"100"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"squares_list += fill_in\n",
"len(squares_list)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Since we're about to randomize the order of the list, we need to set a seed so that it will give the same random order every time."
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"ExecuteTime": {
"end_time": "2021-02-07T15:58:52.333078Z",
"start_time": "2021-02-07T15:58:52.329432Z"
},
"execution": {
"iopub.execute_input": "2023-02-12T20:59:40.994706Z",
"iopub.status.busy": "2023-02-12T20:59:40.994129Z",
"iopub.status.idle": "2023-02-12T20:59:41.000800Z",
"shell.execute_reply": "2023-02-12T20:59:40.999004Z",
"shell.execute_reply.started": "2023-02-12T20:59:40.994571Z"
}
},
"outputs": [],
"source": [
"random.seed(2023)\n",
"random.shuffle(squares_list)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Printing the first 20 items in the list looks like it worked..."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"ExecuteTime": {
"end_time": "2021-02-07T15:58:52.338354Z",
"start_time": "2021-02-07T15:58:52.334855Z"
},
"execution": {
"iopub.execute_input": "2023-02-12T20:59:41.003260Z",
"iopub.status.busy": "2023-02-12T20:59:41.002740Z",
"iopub.status.idle": "2023-02-12T20:59:41.008963Z",
"shell.execute_reply": "2023-02-12T20:59:41.007491Z",
"shell.execute_reply.started": "2023-02-12T20:59:41.003226Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['Bill', 'Sule', 'Grandma', 'Andrew', 'Sam', 'Wynn', 'Dad', 'Dad', 'Sam', 'Katie', 'Jessica', 'Sule', 'Natalie', 'Christopher', 'Grandma', 'Jessica', 'Natalie', 'Mom', 'Dad', 'Wynn']\n"
]
}
],
"source": [
"print(squares_list[:20])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Here's the hard part. I had to reshape the list into a 10x10 numpy array with *reshape*, and then turn that into a Pandas dataframe for nice display and output."
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"ExecuteTime": {
"end_time": "2021-02-07T15:58:52.369610Z",
"start_time": "2021-02-07T15:58:52.343123Z"
},
"execution": {
"iopub.execute_input": "2023-02-12T20:59:41.014276Z",
"iopub.status.busy": "2023-02-12T20:59:41.013596Z",
"iopub.status.idle": "2023-02-12T20:59:41.033969Z",
"shell.execute_reply": "2023-02-12T20:59:41.033258Z",
"shell.execute_reply.started": "2023-02-12T20:59:41.014242Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>0</th>\n",
" <th>1</th>\n",
" <th>2</th>\n",
" <th>3</th>\n",
" <th>4</th>\n",
" <th>5</th>\n",
" <th>6</th>\n",
" <th>7</th>\n",
" <th>8</th>\n",
" <th>9</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Bill</td>\n",
" <td>Sule</td>\n",
" <td>Grandma</td>\n",
" <td>Andrew</td>\n",
" <td>Sam</td>\n",
" <td>Wynn</td>\n",
" <td>Dad</td>\n",
" <td>Dad</td>\n",
" <td>Sam</td>\n",
" <td>Katie</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Jessica</td>\n",
" <td>Sule</td>\n",
" <td>Natalie</td>\n",
" <td>Christopher</td>\n",
" <td>Grandma</td>\n",
" <td>Jessica</td>\n",
" <td>Natalie</td>\n",
" <td>Mom</td>\n",
" <td>Dad</td>\n",
" <td>Wynn</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Natalie</td>\n",
" <td>Andrew</td>\n",
" <td>EVERYONE</td>\n",
" <td>Carla</td>\n",
" <td>Bill</td>\n",
" <td>Natalie</td>\n",
" <td>Grandma</td>\n",
" <td>Michael</td>\n",
" <td>Michael</td>\n",
" <td>Katie</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Sule</td>\n",
" <td>Christopher</td>\n",
" <td>Christopher</td>\n",
" <td>Andrew</td>\n",
" <td>Bill</td>\n",
" <td>Christopher</td>\n",
" <td>Wynn</td>\n",
" <td>Katie</td>\n",
" <td>Mom</td>\n",
" <td>Bill</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Jessica</td>\n",
" <td>Natalie</td>\n",
" <td>Carla</td>\n",
" <td>Andrew</td>\n",
" <td>Lauren</td>\n",
" <td>Mom</td>\n",
" <td>Elliott</td>\n",
" <td>Natalie</td>\n",
" <td>Michael</td>\n",
" <td>Lauren</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>Sam</td>\n",
" <td>Katie</td>\n",
" <td>Elliott</td>\n",
" <td>Carla</td>\n",
" <td>Sam</td>\n",
" <td>Grandma</td>\n",
" <td>Grandma</td>\n",
" <td>Elliott</td>\n",
" <td>Jessica</td>\n",
" <td>EVERYONE</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>Elliott</td>\n",
" <td>Carla</td>\n",
" <td>Sam</td>\n",
" <td>Dad</td>\n",
" <td>Wynn</td>\n",
" <td>Andrew</td>\n",
" <td>Carla</td>\n",
" <td>Katie</td>\n",
" <td>Wynn</td>\n",
" <td>Grandma</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>Lauren</td>\n",
" <td>EVERYONE</td>\n",
" <td>Wynn</td>\n",
" <td>Bill</td>\n",
" <td>Michael</td>\n",
" <td>Dad</td>\n",
" <td>Mom</td>\n",
" <td>Carla</td>\n",
" <td>Jessica</td>\n",
" <td>Michael</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>Dad</td>\n",
" <td>Lauren</td>\n",
" <td>Michael</td>\n",
" <td>Bill</td>\n",
" <td>Lauren</td>\n",
" <td>Christopher</td>\n",
" <td>Christopher</td>\n",
" <td>Elliott</td>\n",
" <td>Sule</td>\n",
" <td>Mom</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>Mom</td>\n",
" <td>Sule</td>\n",
" <td>Jessica</td>\n",
" <td>Katie</td>\n",
" <td>Sule</td>\n",
" <td>Elliott</td>\n",
" <td>EVERYONE</td>\n",
" <td>Andrew</td>\n",
" <td>Lauren</td>\n",
" <td>Sam</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 0 1 2 3 4 5 \\\n",
"0 Bill Sule Grandma Andrew Sam Wynn \n",
"1 Jessica Sule Natalie Christopher Grandma Jessica \n",
"2 Natalie Andrew EVERYONE Carla Bill Natalie \n",
"3 Sule Christopher Christopher Andrew Bill Christopher \n",
"4 Jessica Natalie Carla Andrew Lauren Mom \n",
"5 Sam Katie Elliott Carla Sam Grandma \n",
"6 Elliott Carla Sam Dad Wynn Andrew \n",
"7 Lauren EVERYONE Wynn Bill Michael Dad \n",
"8 Dad Lauren Michael Bill Lauren Christopher \n",
"9 Mom Sule Jessica Katie Sule Elliott \n",
"\n",
" 6 7 8 9 \n",
"0 Dad Dad Sam Katie \n",
"1 Natalie Mom Dad Wynn \n",
"2 Grandma Michael Michael Katie \n",
"3 Wynn Katie Mom Bill \n",
"4 Elliott Natalie Michael Lauren \n",
"5 Grandma Elliott Jessica EVERYONE \n",
"6 Carla Katie Wynn Grandma \n",
"7 Mom Carla Jessica Michael \n",
"8 Christopher Elliott Sule Mom \n",
"9 EVERYONE Andrew Lauren Sam "
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"squares_df = pd.DataFrame(np.array(squares_list).reshape(10,10))\n",
"squares_df"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"execution": {
"iopub.execute_input": "2023-02-12T20:59:41.036505Z",
"iopub.status.busy": "2023-02-12T20:59:41.035262Z",
"iopub.status.idle": "2023-02-12T20:59:41.043261Z",
"shell.execute_reply": "2023-02-12T20:59:41.042612Z",
"shell.execute_reply.started": "2023-02-12T20:59:41.036456Z"
}
},
"outputs": [],
"source": [
"squares_df.to_csv('squares_2023.csv')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"gist": {
"data": {
"description": "Super Bowl 2021 Squares",
"public": true
},
"id": ""
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment