- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex71.py
More file actions
Latest commit
27 lines (21 loc) · 751 Bytes
/
Copy pathex71.py
File metadata and controls
27 lines (21 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
'''
编写input()和output()函数输入,输出5个学生的数据记录。
'''
classStudent(object):
name=""
age=""
score= {"语文": "", "数学": "", "英语": ""}
definput_student(self):
self.name=input("输入姓名:")
self.age=input("输入年龄:")
forkeysinself.score.keys():
self.score[keys] =input("输入%s分数:"%keys)
defoutput_student(self):
print("姓名:%s"%self.name)
print("年龄:%s"%self.age)
forkeys, valuesinself.score.items():
print("%s分数:%s"% (keys, values))
foriinrange(5):
student=Student()
student.input_student()
student.output_student()