回答編集履歴
3
関数名変更
answer
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
常に `0.` で始めたい場合:
|
3
3
|
```py
|
4
4
|
>>> import re
|
5
|
-
>>> def
|
5
|
+
>>> def e(value):
|
6
6
|
... return re.sub("(.).(...).e(.*)", lambda m: f"0.{m[1]}{m[2]}e{int(m[3])+1:+03}", f"{value:10.4e}")
|
7
7
|
...
|
8
|
-
>>> print(
|
8
|
+
>>> print(e(100000000))
|
9
9
|
0.1000e+09
|
10
10
|
```
|
2
説明追記
answer
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
文字列加工するくらいしか思いつきません。
|
2
|
-
|
2
|
+
常に `0.` で始めたい場合:
|
3
3
|
```py
|
4
4
|
>>> import re
|
5
5
|
>>> def down(value):
|
1
バグ修正
answer
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
```py
|
4
4
|
>>> import re
|
5
|
-
>>> def
|
5
|
+
>>> def down(value):
|
6
|
-
... return re.sub("(.).(...).e(.
|
6
|
+
... return re.sub("(.).(...).e(.*)", lambda m: f"0.{m[1]}{m[2]}e{int(m[3])+1:+03}", f"{value:10.4e}")
|
7
7
|
...
|
8
|
-
>>> print(
|
8
|
+
>>> print(down(100000000))
|
9
9
|
0.1000e+09
|
10
10
|
```
|