diff --git a/student.py b/student.py new file mode 100644 index 0000000..7634d72 --- /dev/null +++ b/student.py @@ -0,0 +1,14 @@ +class Student: + """学生类""" + + def __init__(self,name,gender): + """初始化学生信息""" + self.name = name + self.gender = gender + + def __str__(self) -> str: + return f'姓名:{self.name} 性别:{self.gender}' + + def change_info(self,new_name,new_gender): + self.name = new_name + self.gender = new_gender