回答編集履歴
1
追記
answer
CHANGED
@@ -7,4 +7,19 @@
|
|
7
7
|
except ValueError:
|
8
8
|
pass
|
9
9
|
print(n)
|
10
|
+
```
|
11
|
+
ついでに2つの数字を入力する場合。
|
12
|
+
```
|
13
|
+
state = 0
|
14
|
+
while state < 2:
|
15
|
+
try:
|
16
|
+
if state < 1:
|
17
|
+
a = int(input('数字aを入力:'))
|
18
|
+
state = 1
|
19
|
+
elif state < 2:
|
20
|
+
b = int(input('数字bを入力:'))
|
21
|
+
state = 2
|
22
|
+
except ValueError:
|
23
|
+
print('error')
|
24
|
+
print(a, b)
|
10
25
|
```
|