第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

求幫找代碼異常打印輸出

#?Enter?a?code
class?Person(object):
????def?__init__(self,?name,?gender):
????????self.name?=?name
????????self.gender?=?gender
????def?who(self):
????????return?'I?am?a?Person,?my?name?is?%s'?%?self.name

class?Student(Person):
????def?__init__(self,?name,?gender,?score):
????????super(Student,?self).__init__(name,?gender)
????????self.score?=?score
????def?who(self):
????????return?'I?am?a?Student,?my?score?is?%s'?%?self.score

class?Teacher(Person):
????def?__init__(self,?name,?gender,?course):
????????super(Teacher,?self).__init__(name,?gender)
????????self.course?=?course
????def?who(self):
????????return?'I?am?a?Teacher,teching?%s'%self.course
????????
class?SkillMixin(object):
????def?__init__(self):
????????pass
????
????def?get_skill(self):
????????print('I?hava?a?skill')
????????
class?BasketballSkillMixin(SkillMixin):
????def?__init__(self):
????????super(BasketballSkillMixin,self).__init__()
????????self.skill='basketball'
????
????def?get_skill(self):
????????print('I?hava?a?%s?skill'%self.skill)

class?FootballSkillMixin(SkillMixin):
????def?__init__(self):
????????super(FootballSkillMixin,self).__init__()
????????self.skill='football'
????????
????def?get_skill(self):
????????print('I?hava?a?%s?skill'%self.skill)

class?MyBasketStudent(BasketballSkillMixin,Student):
????def?__init__(self,name,gender,score):
????????Student.__init__(self,name,gender,score)
????????BasketballSkillMixin.__init__(self)
????????
class?MyFootballTeacher(FootballSkillMixin,Teacher):
????def?__init__(self,name,gender,course):
????????Teacher.__init__(self,name,gender,course)
????????FootballSkillMixin.__init__(self)
????
a=MyBasketStudent('xiaoming','man',98)
print(a.who())
print(a.get_skill())
#?b=MyFootballTeacher('lixing','man','physical')
#?print(b.who())
#?print(b.get_skill())

http://img1.sycdn.imooc.com//63d3fb5f0001c2f803930202.jpg

疑問(wèn):為啥最后一行多打印了一個(gè)None?

正在回答

2 回答

?print('I?hava?a?%s?skill'%self.skill)都改成return 'I?hava?a?%s?skill'%self.skill。

或者print(a.get_skill())改成a.get_skill()直接運(yùn)行,因?yàn)槟愣x的def?get_skill(self):自帶打印了。

0 回復(fù) 有任何疑惑可以回復(fù)我~

參考下這個(gè)呢https://www.zhihu.com/question/434250863,可能是這個(gè)原因

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

求幫找代碼異常打印輸出

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)