回答編集履歴

1

isを==に変更

2019/09/20 04:25

投稿

FiroProchainezo
FiroProchainezo

スコア2421

test CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  for person in students:
12
12
 
13
- if students[person]["性別"] is "男":
13
+ if students[person]["性別"] == "男":
14
14
 
15
15
  man.append(students[person])
16
16
 
@@ -38,7 +38,7 @@
38
38
 
39
39
  for person in students:
40
40
 
41
- if students[person]["性別"] is "男":
41
+ if students[person]["性別"] == "男":
42
42
 
43
43
  man[person] = students[person]
44
44
 
@@ -68,7 +68,7 @@
68
68
 
69
69
  for person in students:
70
70
 
71
- if students[person]["性別"] is "男":
71
+ if students[person]["性別"] == "男":
72
72
 
73
73
  man.append({person : students[person]})
74
74
 
@@ -77,3 +77,9 @@
77
77
  woman.append({person : students[person]})
78
78
 
79
79
  ```
80
+
81
+
82
+
83
+ ### 参考資料
84
+
85
+ [Pythonにおけるisと==の使い分け](https://qiita.com/mukoya/items/e8f50ce53defba9dbee3)