Discuss / Python / 摸鱼跑来的

摸鱼跑来的

Topic source

leo咕咕白

#1 Created at ... [Delete] [Delete and Lock User]

class Student(object):

    def __init__(self, name, score):

        self.name = name

        self.score = score

    def get_grade(self):

        if self.score<0 or self.score>100:

            raise ValueError('输入不符合要求')

        if self.score >= 60 and self.score<80:

            return 'B'

        if self.score >= 80 and self.score<=100:

            return 'A' ​

       ​return 'C'


  • 1

Reply