回答編集履歴
1
追記
test
CHANGED
@@ -17,3 +17,33 @@
|
|
17
17
|
print(n)
|
18
18
|
|
19
19
|
```
|
20
|
+
|
21
|
+
ついでに2つの数字を入力する場合。
|
22
|
+
|
23
|
+
```
|
24
|
+
|
25
|
+
state = 0
|
26
|
+
|
27
|
+
while state < 2:
|
28
|
+
|
29
|
+
try:
|
30
|
+
|
31
|
+
if state < 1:
|
32
|
+
|
33
|
+
a = int(input('数字aを入力:'))
|
34
|
+
|
35
|
+
state = 1
|
36
|
+
|
37
|
+
elif state < 2:
|
38
|
+
|
39
|
+
b = int(input('数字bを入力:'))
|
40
|
+
|
41
|
+
state = 2
|
42
|
+
|
43
|
+
except ValueError:
|
44
|
+
|
45
|
+
print('error')
|
46
|
+
|
47
|
+
print(a, b)
|
48
|
+
|
49
|
+
```
|