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