python--class test
# !usr/bin/env python3
#-*- coding:utf-8 -*-
'a test class'
class Student(object):
def __init__(self,name,score):
self.name=name
self.score=score
def print_score(self):
print('information:%s %s' %(self.name ,self.score))
def compare_score(self):
if self.score>90:
print('优秀')
elif self.score>80:
print('良好')
else:
print('还需要加油')
lucy=Student('Lucy',99)
print('name :%s score:%s' %(lucy.name,lucy.score) )
lucy.print_score()
lucy.compare_score()