This question shows research effort; it is useful and clear
0
This question does not show any research effort; it is unclear or not useful
Bookmark this question.
Show activity on this post.
当我尝试运行此代码时,我得到了NameError。“未定义全局名称 j”。我该如何解决?
def test(j):
for i in range(j):
j = i**2
if __name__=='__main__':
from timeit import Timer
j = 30
t = Timer("test(j)","from __main__ import test")
print( t.timeit(j))