title: Simulating a football league in python
body: <p>I could use some help on this. I want to simulate a football league in python for an arbitrary number of teams and tally the points over a season in a table. The rules are simple:</p>
  <ol>
  <li>Every team in the league plays each other twice. so each team plays 2*(Nteams_in_league -1)</li>
  <li>Teams have a 50% chance of a winning.</li>
  <li>There are only two possible outcomes, win or lose.</li>
  <li>A win gets 3 points, and a loss gets a team 0 points.</li>
  </ol>
  <p>Here's an example of the output I'm looking for with a league of 8 teams over 11 seasons. It's based off an attempt I made but isn't completely correct because it's not allocating point across the winner and loser correctly.</p>
  <p>columns = season,
  rows = team,
  observations are the points tally.</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: center;"><strong>1</strong></th>
  <th style="text-align: center;"><strong>2</strong></th>
  <th style="text-align: center;"><strong>3</strong></th>
  <th style="text-align: center;"><strong>4</strong></th>
  <th style="text-align: center;"><strong>5</strong></th>
  <th style="text-align: center;"><strong>6</strong></th>
  <th style="text-align: center;"><strong>7</strong></th>
  <th style="text-align: center;"><strong>8</strong></th>
  <th style="text-align: center;"><strong>9</strong></th>
  <th style="text-align: center;"><strong>10</strong></th>
  <th style="text-align: center;"><strong>11</strong></th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: center;">1</td>
  <td style="text-align: center;">57</td>
  <td style="text-align: center;">51</td>
  <td style="text-align: center;">66</td>
  <td style="text-align: center;">54</td>
  <td style="text-align: center;">60</td>
  <td style="text-align: center;">51</td>
  <td style="text-align: center;">57</td>
  <td style="text-align: center;">54</td>
  <td style="text-align: center;">45</td>
  <td style="text-align: center;">72</td>
  </tr>
  <tr>
  <td style="text-align: center;">2</td>
  <td style="text-align: center;">51</td>
  <td style="text-align: center;">51</td>
  <td style="text-align: center;">42</td>
  <td style="text-align: center;">51</td>
  <td style="text-align: center;">66</td>
  <td style="text-align: center;">60</td>
  <td style="text-align: center;">63</td>
  <td style="text-align: center;">60</td>
  <td style="text-align: center;">81</td>
  <td style="text-align: center;">63</td>
  </tr>
  <tr>
  <td style="text-align: center;">3</td>
  <td style="text-align: center;">51</td>
  <td style="text-align: center;">69</td>
  <td style="text-align: center;">51</td>
  <td style="text-align: center;">48</td>
  <td style="text-align: center;">36</td>
  <td style="text-align: center;">48</td>
  <td style="text-align: center;">57</td>
  <td style="text-align: center;">54</td>
  <td style="text-align: center;">48</td>
  <td style="text-align: center;">60</td>
  </tr>
  <tr>
  <td style="text-align: center;">4</td>
  <td style="text-align: center;">54</td>
  <td style="text-align: center;">57</td>
  <td style="text-align: center;">66</td>
  <td style="text-align: center;">54</td>
  <td style="text-align: center;">75</td>
  <td style="text-align: center;">60</td>
  <td style="text-align: center;">60</td>
  <td style="text-align: center;">66</td>
  <td style="text-align: center;">69</td>
  <td style="text-align: center;">42</td>
  </tr>
  <tr>
  <td style="text-align: center;">5</td>
  <td style="text-align: center;">72</td>
  <td style="text-align: center;">57</td>
  <td style="text-align: center;">63</td>
  <td style="text-align: center;">57</td>
  <td style="text-align: center;">60</td>
  <td style="text-align: center;">54</td>
  <td style="text-align: center;">48</td>
  <td style="text-align: center;">66</td>
  <td style="text-align: center;">54</td>
  <td style="text-align: center;">42</td>
  </tr>
  <tr>
  <td style="text-align: center;">6</td>
  <td style="text-align: center;">54</td>
  <td style="text-align: center;">45</td>
  <td style="text-align: center;">54</td>
  <td style="text-align: center;">45</td>
  <td style="text-align: center;">60</td>
  <td style="text-align: center;">57</td>
  <td style="text-align: center;">51</td>
  <td style="text-align: center;">60</td>
  <td style="text-align: center;">66</td>
  <td style="text-align: center;">51</td>
  </tr>
  <tr>
  <td style="text-align: center;">7</td>
  <td style="text-align: center;">51</td>
  <td style="text-align: center;">63</td>
  <td style="text-align: center;">72</td>
  <td style="text-align: center;">63</td>
  <td style="text-align: center;">63</td>
  <td style="text-align: center;">54</td>
  <td style="text-align: center;">60</td>
  <td style="text-align: center;">63</td>
  <td style="text-align: center;">54</td>
  <td style="text-align: center;">66</td>
  </tr>
  <tr>
  <td style="text-align: center;">8</td>
  <td style="text-align: center;">66</td>
  <td style="text-align: center;">57</td>
  <td style="text-align: center;">42</td>
  <td style="text-align: center;">57</td>
  <td style="text-align: center;">51</td>
  <td style="text-align: center;">57</td>
  <td style="text-align: center;">51</td>
  <td style="text-align: center;">75</td>
  <td style="text-align: center;">72</td>
  <td style="text-align: center;">60</td>
  </tr>
  </tbody>
  </table>
  </div>