例子中引用循環(huán)變量返回值為函數(shù),所以會(huì)受到循環(huán)變量變化影響,任務(wù)中將返回值進(jìn)行實(shí)際賦值,后續(xù)變量產(chǎn)生變化不對(duì)已賦值變量產(chǎn)生影響,不知道這么理解對(duì)不對(duì)
2020-09-24
#set方法作用,i guess
Animal('1', 1, '1')
print(dog.get_info())
dog.set_info('2',2,'2')
print(dog.get_info())
Animal('1', 1, '1')
print(dog.get_info())
dog.set_info('2',2,'2')
print(dog.get_info())
2020-09-23
L1 = ['bob', 'about', 'Zoo', 'Credit']
L2 = sorted(L1,key=str.lower)
print(L2)
L2 = sorted(L1,key=str.lower)
print(L2)
2020-09-18
已采納回答 / 慕蓋茨7031404
程序里的 self.p * r.q用來計(jì)算通分后分?jǐn)?shù)的分子。這里把有理數(shù)用分?jǐn)?shù)表示,有理數(shù)的運(yùn)算也就成了分?jǐn)?shù)的運(yùn)算,如計(jì)算:1/3 + 1/5,先進(jìn)行通分變成:5/15 + 3/15,這個(gè)5/15的分子就是程序里的 self.p * r.q
2020-09-17
最新回答 / qq_狐耳小乖們_0
OK,已解決.pycharm 是 2.7 版本的,def A(B) :????print("中文") ?有時(shí)亂碼,去括號(hào)就好
2020-09-08
File "index.py", line 8
SyntaxError: Non-ASCII character '\xe5' in file index.py on line 8, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
SyntaxError: Non-ASCII character '\xe5' in file index.py on line 8, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
2020-09-05