回答編集履歴
1
追記
answer
CHANGED
@@ -1,8 +1,25 @@
|
|
1
1
|
```Python
|
2
|
-
print(*
|
2
|
+
print(*lst, sep='')
|
3
3
|
```
|
4
4
|
|
5
5
|
あるいは
|
6
6
|
```Python
|
7
|
-
print(''.join(
|
7
|
+
print(''.join(lst))
|
8
|
-
```
|
8
|
+
```
|
9
|
+
|
10
|
+
---
|
11
|
+
変数をlistと命名するのは厳に避けてください。
|
12
|
+
分かりづらいエラーを引き起こします。
|
13
|
+
```Python
|
14
|
+
>>> list('spam')
|
15
|
+
['s', 'p', 'a', 'm']
|
16
|
+
>>>
|
17
|
+
>>> list = [1, 2, 3]
|
18
|
+
>>>
|
19
|
+
>>> list('spam')
|
20
|
+
Traceback (most recent call last):
|
21
|
+
File "<stdin>", line 1, in <module>
|
22
|
+
TypeError: 'list' object is not callable
|
23
|
+
```
|
24
|
+
|
25
|
+
同様につけてしまいがちな名前としては、`max` `id` `len` `str` などがあります。
|