回答編集履歴

1

追記

2019/12/06 09:40

投稿

LouiS0616
LouiS0616

スコア35660

test CHANGED
@@ -17,3 +17,25 @@
17
17
  return response == "y"
18
18
 
19
19
  ```
20
+
21
+
22
+
23
+ ---
24
+
25
+ こんなふうに組むこともできます。
26
+
27
+ ```Python
28
+
29
+ def confirm(message: str) -> bool: # 返り値はboolでは?
30
+
31
+ response = ''
32
+
33
+ while not response:
34
+
35
+ response = input(f"{message} [y/n] ").lower()
36
+
37
+
38
+
39
+ return response[0] == 'y'
40
+
41
+ ```