Skip to content

Instantly share code, notes, and snippets.

@trakhov
Last active December 16, 2015 23:29
Show Gist options
  • Save trakhov/5514368 to your computer and use it in GitHub Desktop.
Save trakhov/5514368 to your computer and use it in GitHub Desktop.
def print_strategy(P, name):
s = '$ {} = \left('.format(name)
for el in P:
if el.denominator > 1:
s += '\\frac{{ {} }}{{ {} }}, '.format(el.numerator, el.denominator)
else:
s += '{}, '.format(el)
s = s.rstrip(', ')
s += '\\right)$'
return s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment