-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNumbers.py
131 lines (80 loc) · 2.04 KB
/
Numbers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
from functools import total_ordering
@total_ordering
class Numbers:
__slots__ = 'val'
def __repr__(self):
return str(self.val)
def __eq__(self, other):
return self.val == other
def __lt__(self, other):
return self.val < other
def __abs__(self):
return abs(self.val)
def __add__(self, other):
return self.val+other
def __and__(self, other):
return self.val & other
def __bool__(self):
return self.val != 0
def __ceil__(self):
return self.val
def __divmod__(self, other):
return divmod(self.val, other)
def __float__(self):
return float(self.val)
def __floordiv__(self, other):
return self.val//other
def __floor__(self):
return self.val
def __hash__(self):
return hash(self.val)
def __int__(self):
return self.val
def __invert__(self):
return ~self.val
def __lshift__(self, other):
return self.val << other
def __mod__(self, other):
return self.val % other
def __mul__(self, other):
return self.val*other
def __neg__(self):
return -self.val
def __or__(self, other):
return self.val | other
def __pos__(self):
return +self.val
def __pow__(self, value, mod=None):
return pow(self.val, value, mod)
def __round__(self):
return self.val
def __rshift__(self, other):
return self.val >> other
def __sub__(self, other):
return self.val-other
def __truediv__(self, other):
return self.val/other
def __trunc__(self):
return self.val
def __xor__(self, other):
return self.val ^ other
class Zero(Numbers):
val = 0
class One(Numbers):
val = 1
class Two(Numbers):
val = 2
class Three(Numbers):
val = 3
class Four(Numbers):
val = 4
class Five(Numbers):
val = 5
class Six(Numbers):
val = 6
class Seven(Numbers):
val = 7
class Eight(Numbers):
val = 8
class Nine(Numbers):
val = 9