回答編集履歴
1
Fix code
answer
CHANGED
@@ -9,10 +9,10 @@
|
|
9
9
|
examinee_score = randint(0, 100)
|
10
10
|
score[examinee_number] = examinee_score
|
11
11
|
print(f"受験番号{examinee_number:>3}番:{examinee_score:>3}点")
|
12
|
-
ave=sum(score)/len(score)
|
12
|
+
ave=sum(score.values())/len(score)
|
13
13
|
print(f"\n平均点:{ave:.1f}点")
|
14
|
-
print(f"最高点:{max(score)}点")
|
14
|
+
print(f"最高点:{max(score.values())}点")
|
15
|
-
print(f"最低点:{min(score)}点")
|
15
|
+
print(f"最低点:{min(score.values())}点")
|
16
16
|
print("\n合格者(60点以上) :")
|
17
17
|
points={number: score for number, score in score.items() if score >= 60}
|
18
18
|
for number, score in points.items():
|
@@ -24,19 +24,19 @@
|
|
24
24
|
```console
|
25
25
|
$ python test.py
|
26
26
|
受験者数は?:5
|
27
|
-
受験番号 1番:
|
27
|
+
受験番号 1番: 48点
|
28
|
-
受験番号 2番:
|
28
|
+
受験番号 2番: 9点
|
29
|
-
受験番号 3番:
|
29
|
+
受験番号 3番: 15点
|
30
|
-
受験番号 4番:100点
|
31
|
-
受験番号
|
30
|
+
受験番号 4番: 81点
|
31
|
+
受験番号 5番: 79点
|
32
32
|
|
33
|
-
平均点:
|
33
|
+
平均点:46.4点
|
34
|
-
最高点:
|
34
|
+
最高点:81点
|
35
|
-
最低点:
|
35
|
+
最低点:9点
|
36
36
|
|
37
37
|
合格者(60点以上) :
|
38
|
-
受験番号 4番:100点
|
39
|
-
受験番号
|
38
|
+
受験番号 4番: 81点
|
39
|
+
受験番号 5番: 79点
|
40
40
|
```
|
41
41
|
|
42
42
|
参考: [5.5. 辞書型 (dictionary) | 5. データ構造 — Python 3.8.5 ドキュメント](https://docs.python.org/ja/3/tutorial/datastructures.html#dictionaries)
|