回答編集履歴
2
追記
answer
CHANGED
@@ -7,6 +7,7 @@
|
|
7
7
|
> ```
|
8
8
|
|
9
9
|
タイポです。`resonse` ⇒ `response`
|
10
|
+
また、今回のエラーとは直接の繋がりは無いですが、`respone`と打っている箇所も有りますね。
|
10
11
|
|
11
12
|
```Python
|
12
13
|
>>> def func(cond):
|
1
追記
answer
CHANGED
@@ -6,4 +6,19 @@
|
|
6
6
|
return response
|
7
7
|
> ```
|
8
8
|
|
9
|
-
タイポです。`resonse` ⇒ `response`
|
9
|
+
タイポです。`resonse` ⇒ `response`
|
10
|
+
|
11
|
+
```Python
|
12
|
+
>>> def func(cond):
|
13
|
+
... if cond:
|
14
|
+
... a = 42
|
15
|
+
... return a
|
16
|
+
...
|
17
|
+
>>> func(True)
|
18
|
+
42
|
19
|
+
>>> func(False)
|
20
|
+
Traceback (most recent call last):
|
21
|
+
File "<stdin>", line 1, in <module>
|
22
|
+
File "<stdin>", line 4, in func
|
23
|
+
UnboundLocalError: local variable 'a' referenced before assignment
|
24
|
+
```
|