Add user input
This commit is contained in:
parent
ee39f1f88d
commit
ce6babfeb9
42
main.py
42
main.py
@ -1,4 +1,6 @@
|
||||
import itertools
|
||||
import ast
|
||||
import sys
|
||||
|
||||
|
||||
class Poly:
|
||||
@ -313,39 +315,23 @@ class PolyIntField:
|
||||
|
||||
def __str__(self):
|
||||
str_form = "[\n\t"
|
||||
str_form += str(self.invertibles()) + ",\n\t"
|
||||
str_form += str(self.zero_divisors()) + ",\n\t"
|
||||
str_form += str(self.nilpotents()) + ",\n\t"
|
||||
str_form += str(self.idempotents()) + "\n"
|
||||
str_form += str(self.invertibles()) + ", # odwracalne\n\t"
|
||||
str_form += str(self.zero_divisors()) + ", # dzielniki zera\n\t"
|
||||
str_form += str(self.nilpotents()) + ", # nilpotenty\n\t"
|
||||
str_form += str(self.idempotents()) + " # idempotenty\n"
|
||||
str_form += "]\n"
|
||||
return str_form
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# print(phi(36))
|
||||
|
||||
# a = Poly(5, [1])
|
||||
# b = Poly(5, [3, 5])
|
||||
# # print(a == )
|
||||
# p = Poly(2, [1, 1, 1])
|
||||
# c = Poly(2, [1, 1])
|
||||
# d = Poly(2, [1])
|
||||
# print(c * Poly(2, [0, 1]) % p)
|
||||
# print(d)
|
||||
# print((c * Poly(2, [0, 1]) % p) == d)
|
||||
# pf = PolyIntField(2, [1, 1, 1])
|
||||
# print(pf.invertibles())
|
||||
# a = pf.invertibles()
|
||||
# for i in a:
|
||||
# print(i)
|
||||
if len(sys.argv) < 3:
|
||||
print("Niepoprawny input")
|
||||
exit(1)
|
||||
|
||||
# a = Poly(5, [1, 1])
|
||||
# print(a.elements == {"x1": 1, "x0": 1})
|
||||
# [[1], [2], [0, 1], [0, 2], [0, 0, 1], [1, 0, 1], [2, 1, 1], [2, 2, 1], [0, 0, 2], [2, 0, 2], [1, 1, 2], [1, 2, 2]], # odwracalne
|
||||
# [ ],
|
||||
if sys.argv[1].find(",") != -1:
|
||||
print(f"Proszę użyć spacji, nie przecinków: '{sys.argv[1]}'")
|
||||
exit(1)
|
||||
|
||||
# [[0, 0, 1], [0, 0, 2], [0, 1], [0, 1, 1], [0, 1, 2], [0, 2], [0, 2, 1], [0, 2, 2], [1], [1, 0, 1], [1, 0, 2], [1, 1], [1, 1, 1], [1, 1, 2], [1, 2], [1, 2, 1], [1, 2, 2], [2], [2, 0, 1], [2, 0, 2], [2, 1], [2, 1, 1], [2, 1, 2], [2, 2], [2, 2, 1], [2, 2, 2]
|
||||
d = [[1], [2], [0, 1], [0, 2], [0, 0, 1], [1, 0, 1], [2, 1, 1], [2, 2, 1], [0, 0, 2], [2, 0, 2], [1, 1, 2], [1, 2, 2]]
|
||||
print(len(d))
|
||||
poly_field = PolyIntField(3, [1, 1, 2, 2])
|
||||
print(poly_field)
|
||||
field = PolyIntField(int(sys.argv[1]), ast.literal_eval(sys.argv[2]))
|
||||
print(field)
|
||||
|
Loading…
Reference in New Issue
Block a user