質問編集履歴
2
__init__を__add__に修正しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
def __init__(self, number):
|
18
18
|
self.n = number
|
19
19
|
|
20
|
-
def
|
20
|
+
def __add__(self, other):
|
21
21
|
return abs(self.n + other.n)
|
22
22
|
|
23
23
|
x = num(-20)
|
1
self.number ではなく self.nです。すみません。
title
CHANGED
File without changes
|
body
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
```Python
|
16
16
|
class num:
|
17
17
|
def __init__(self, number):
|
18
|
-
self.
|
18
|
+
self.n = number
|
19
19
|
|
20
20
|
def __init__(self, other):
|
21
21
|
return abs(self.n + other.n)
|