Student-Manager/student.py

15 lines
383 B
Python
Raw Permalink Normal View History

2024-07-11 16:01:07 +08:00
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