抱歉问这么简单的事。。。你知道吗
我制作了这个factorial.py
文件:
# Find the factorial of a number
def fact(n):
p = 1
for i in range(1, n+1):
p = p*i
return p
if __name__ == '__main__':
n = int(input('Enter an integer to find the factorial of: '))
f = fact(n)
print('Factorial of {0}: {1}'.format(n, f))
保存在C:\Users\usersname
然后在新的idle
我写了from factorial import fact
,
但它导致了一个错误,如下图所示:
目前没有回答
相关问题 更多 >
编程相关推荐