回答編集履歴
1
追記
test
CHANGED
@@ -13,3 +13,57 @@
|
|
13
13
|
print(i)
|
14
14
|
|
15
15
|
```
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
---
|
20
|
+
|
21
|
+
& を and の代わりに用いることもできますが、後者は短絡評価を行う為動作は若干異なり得ます。
|
22
|
+
|
23
|
+
```Python
|
24
|
+
|
25
|
+
def return_false():
|
26
|
+
|
27
|
+
print('return false')
|
28
|
+
|
29
|
+
return False
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
print('&')
|
34
|
+
|
35
|
+
return_false() & return_false()
|
36
|
+
|
37
|
+
print('-' * 8)
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
print('and')
|
42
|
+
|
43
|
+
return_false() and return_false()
|
44
|
+
|
45
|
+
print('-' * 8)
|
46
|
+
|
47
|
+
```
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
**実行結果** [Wandbox](https://wandbox.org/permlink/fzUhZSvWetQamvJq)
|
52
|
+
|
53
|
+
```
|
54
|
+
|
55
|
+
&
|
56
|
+
|
57
|
+
return false
|
58
|
+
|
59
|
+
return false
|
60
|
+
|
61
|
+
--------
|
62
|
+
|
63
|
+
and
|
64
|
+
|
65
|
+
return false
|
66
|
+
|
67
|
+
--------
|
68
|
+
|
69
|
+
```
|