问题:sit()和roll_over()函数中已经有print(),在实例调用函数的时候,又用了print(),结果竟然没有报错,但是显示了正确的语句和None,如何理解None?代码:class Dog():def __init__(self,name,age): self.name = name self.age = agedef sit(self):
print(self.name.title() + " is now sitting.")def roll_over(self):
print(self.name.title() + " rolled over!")my_dog = Dog('willie',6)print(my_dog.roll_over())结果:
添加回答
举报
0/150
提交
取消