You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
620 B
27 lines
620 B
# -*- coding: utf-8 -*-
|
|
"""
|
|
Created on Sun Mar 15 21:26:00 2026
|
|
|
|
@author: lenovo
|
|
"""
|
|
|
|
class Student:
|
|
def __init__(self, student_id: int, name: str, score: float):
|
|
# 对应 Java 里的 private 成员变量
|
|
self.student_id = student_id
|
|
self.name = name
|
|
self.score = score
|
|
|
|
def study(self):
|
|
# 对应 Java 里的 study() 方法
|
|
print(f"{self.name} 正在学习...")
|
|
|
|
# 对应 Java 里的 Getter 方法
|
|
def get_student_id(self):
|
|
return self.student_id
|
|
|
|
def get_name(self):
|
|
return self.name
|
|
|
|
def get_score(self):
|
|
return self.score
|