Skip to content

Commit

Permalink
Update poly.py
Browse files Browse the repository at this point in the history
  • Loading branch information
teschlg committed Nov 12, 2024
1 parent aa9eab7 commit 405d355
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions kryptools/poly.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class Poly:
"""

print_reversed = True # print the terms in reversed order
print_x = "x" # variable for printing
print_pow = "^" # you can change this to "**" if you want it python style

def __init__(self, coeff: list, ring=None, modulus: list = None):
self.coeff = list(coeff)
Expand Down Expand Up @@ -47,8 +49,8 @@ def prx(i: int) -> str:
if i == 0:
return ""
if i == 1:
return "x"
return "x^" + str(i)
return self.__class__.print_x
return self.__class__.print_x + self.__class__.print_pow + str(i)

if not self:
return str(self.coeff[0])
Expand Down

0 comments on commit 405d355

Please sign in to comment.