回答編集履歴
3
表示例追加
test
CHANGED
@@ -20,4 +20,6 @@
|
|
20
20
|
|
21
21
|
print(expanded_form(70704))
|
22
22
|
|
23
|
+
print(expanded_form(90900))
|
24
|
+
|
23
25
|
```
|
2
1行にする
test
CHANGED
@@ -8,11 +8,7 @@
|
|
8
8
|
|
9
9
|
def expanded_form(num):
|
10
10
|
|
11
|
-
return '+'.join([d + '0'*i
|
11
|
+
return '+'.join([d + '0'*i for i, d in enumerate(str(num)[::-1]) if d != '0' or num == 0][::-1])
|
12
|
-
|
13
|
-
for i, d in enumerate(str(num)[::-1])
|
14
|
-
|
15
|
-
if d != '0' or num == 0][::-1])
|
16
12
|
|
17
13
|
|
18
14
|
|
1
表示形式変更
test
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
def expanded_form(num):
|
10
10
|
|
11
|
-
return '+'.join([
|
11
|
+
return '+'.join([d + '0'*i
|
12
12
|
|
13
13
|
for i, d in enumerate(str(num)[::-1])
|
14
14
|
|