九州体育网 - 十年信誉网站

关于作者

Discuss / Python / 演示

演示

Topic source

Hk_Mayfly

#1 Created at ...

class Student(object): def init(self, name, score): self.name = name self.score = score

def print_score(self):
    print('%s:%s' % (self.name, self.score))

def get_grade(self):
    if self.score >= 90:
        return 'A'
    elif self.score >60:
        return 'B'
    elif self.score < 60:
        return 'C'

bart = Student('LiuHua', 98) print(bart.name, bart.get_grade())


  • 1

Reply

WARNING: You are using an old browser that does not support HTML5. Please choose a modern browser (Chrome / Microsoft Edge / Firefox / Sarafi) to get a good experience.