我需要编写2个内部函数f_current,f_counter。当前应该返回,输入值,而计数器必须返回递增值。
但是我下面的代码抛出错误“无法解压缩不可迭代的NoneType对象”。请帮忙。
import sys
import os
# Add the factory function implementation here
def factory(n):
def current(n):
return n
def counter(n):
n = n+1
return self.n
return
f_current, f_counter = factory(int(input()))
if __name__ == "__main__":
with open(os.environ['OUTPUT_PATH'], 'w') as fout:
func_lst = [f_current, f_counter]
res_lst = list()
for func in func_lst:
res_lst.append(func())
fout.write("{}\n{}".format(*res_lst))