所以,我制作了这个模块,并将其命名为Dragon。
class Dragon:
trapped = 0
size = 0
dragonName = 0
def incounter(self):
import random
self.size = random.randrange(1,14)
if self.size >10:
return("It is arguably one of the most large dragon you've ever met in wild.")
elif 11 > self.size >4:
return("Its size is not notably small nor large. At best, its isn't remarkable.")
else:
return("Its size is remarkably small, even if you consider that it almost never had any compounds before.")
self.dragonName = input('You decide to name it: ')
我导入了,然后做了
Mary = Dragon.Dragon
然后,
Mary.incounter
哪个给了我蓝色
<function Dragon.incounter at 0x106098950>
不是我应该得到的。
有人可以帮助我解决这个问题,例如如何使其真正起作用吗?
如果我做错了什么,请告诉我。我只是一个刚认识Python三天的学生。