最新回答 / tinghai
fs 列表的值是三个函数对象:print(count()) # ==> [<function count.<locals>.f at 0x0000020883FC8180>, <function count.<locals>.f at 0x0000020883FC8220>, <function count.<locals>.f at 0x0000020883FC82C0>]
2020-12-13
# encoding:utf-8
class animal(object):
def __init__(self,name,age):
self.name = name
self.age = age
def get(self):
print(self.name,self.age)
dog = animal("汪汪",3)
cat = animal("喵喵",2)
dog.get()
cat.get()
class animal(object):
def __init__(self,name,age):
self.name = name
self.age = age
def get(self):
print(self.name,self.age)
dog = animal("汪汪",3)
cat = animal("喵喵",2)
dog.get()
cat.get()
2020-12-02
最赞回答 / weixin_慕斯3464934
from functools import reduce def calc_prod(list_): def lazy_prod(): def f(x, y): return x * y return reduce(f, list_, 1) return lazy_prod f = calc_prod([1, 2, 3, 4]) f()在最后一行代码前面加上print 更改后为print f()
2020-11-02
最赞回答 / 真实如烟
input只接收用户从键盘输入的内容,please input number:不是用户输入的内容,用户输入的内容只有201,所以print(num)的时候结果是201
2020-10-29