first commit
This commit is contained in:
parent
abc6526143
commit
26631f9b48
24 changed files with 1089 additions and 1 deletions
33
Exercise/exercise-4.1.py
Normal file
33
Exercise/exercise-4.1.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
|
||||
|
||||
# 我们希望将患者按照信息,分别按照性别和年龄分成4个组别,分别存储他们的姓名
|
||||
patient_info = [
|
||||
["Zhang San", 52, "M"],
|
||||
["Li Si", 19, "F"],
|
||||
["Wang Wu", 47, "F"],
|
||||
["Zhao Liu", 29, "M"],
|
||||
]
|
||||
group_M_under_30 = []
|
||||
group_M_over_30 = []
|
||||
group_F_under_30 = []
|
||||
group_F_over_30 = []
|
||||
|
||||
for patient in patient_info:
|
||||
print('new patient:', patient)
|
||||
# 补充代码,使用条件判断,将患者分为4组,分别存储他们的姓名即可
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 应当为 ["Zhao Liu"]
|
||||
print(group_M_under_30)
|
||||
|
||||
# 应当为 ["Zhang San"]
|
||||
print(group_M_over_30)
|
||||
|
||||
# 应当为 ["Li Si"]
|
||||
print(group_F_under_30)
|
||||
|
||||
# 应当为 ["Wang Wu"]
|
||||
print(group_F_over_30)
|
||||
Loading…
Add table
Add a link
Reference in a new issue