Homework4
A MathWikiből
A lap korábbi változatát látod, amilyen Imran (vitalap | szerkesztései) 2021. március 9., 20:43-kor történt szerkesztése után volt.
Modulo ring
Define a class called Moduloz representing modulo n numbers (integers).
For example in modulo 5:
4 + 3 = 2 (because 7 % 5 = 2) 2 - 3 = 4 (because -1 % 5 = 4) 4 * 3 = 2 (because 12 % 5 = 2)
You don't have to implement the operations yet, just define the __init__ and the __str__ methods.
In the constructor you will have two parameters. The first one is the base of the modulo, the second one is the actual number.
The base will be a positive integer, the value will be an integer.
The __str__ should return a string, containing the value.
For example: a = ModuloZ(5, 7) print a
Should print: 2