Skip to content

Instantly share code, notes, and snippets.

Created May 26, 2014 16:04
Show Gist options
  • Save anonymous/5d04611b5e3cd0bb3c86 to your computer and use it in GitHub Desktop.
Save anonymous/5d04611b5e3cd0bb3c86 to your computer and use it in GitHub Desktop.
\documentclass[11pt, oneside]{article}
\usepackage{geometry}
\geometry{letterpaper}
\usepackage{booktabs}
\usepackage[parfill]{parskip}
\usepackage[pyfuture=none]{pythontex}
\begin{document}
\begin{pycode}
from random import randint
from decimal import *
import numpy as np
print r"""
\begin{tabular}{l c c c c c c}
\toprule
"""
print r"\# of Rolls & " + ' & '.join(str(i)+'s' for i in range(1,7)) + r'\\'
print r"\midrule"
for i in range (1,7):
numb = 10**i
win_list = [0 for i in range(6)]
for i in range(1,numb+1):
roll = randint(1,6)
win_list[roll-1] += 1
new_win_list = [str(round(100*float(x)/numb, 2)) for x in win_list]
newer_win_list = []
for b in new_win_list:
if b[-2]=='.' :
newer_win_list.append(b + r'0\%')
else:
newer_win_list.append(b + r'\%')
print str(numb) + ' & ' + ' & '.join(newer_win_list) + r'\\'
print r"\bottomrule"
print r"\end{tabular}"
\end{pycode}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment