回答編集履歴
1
追記
test
CHANGED
@@ -1 +1,45 @@
|
|
1
|
+
【追記】コードを試したところ下記エラーが出ました。
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
```
|
6
|
+
|
7
|
+
Traceback (most recent call last):
|
8
|
+
|
9
|
+
File "C:\Users\test.py", line 7, in <module>
|
10
|
+
|
11
|
+
grade = int(input('Please enter the grade: '))
|
12
|
+
|
13
|
+
ValueError: invalid literal for int() with base 10: '50.5'
|
14
|
+
|
15
|
+
```
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
元のコードを活かすとこんな感じでしょうか?
|
20
|
+
|
21
|
+
```Python
|
22
|
+
|
23
|
+
student_number = int(input('How many great to be enter: '))
|
24
|
+
|
25
|
+
while student_number < 1:
|
26
|
+
|
27
|
+
print('Invalid. Must be greater than 1. Try again.')
|
28
|
+
|
29
|
+
student_number = int(input('How many great to be enter: '))
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
while student_number > 0:
|
34
|
+
|
35
|
+
grade = float(input('Please enter the grade: '))
|
36
|
+
|
37
|
+
student_number -= 1
|
38
|
+
|
39
|
+
```
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
---
|
44
|
+
|
1
|
-
whileの前にifが必要だと思います。
|
45
|
+
~~whileの前にifが必要だと思います。~~
|