N=input('N:')i=1s=1X=int(N)def sum(X):while 1:s=s*XX-=1if not X:breakreturn sSUM=sum(5)print SUM这里哪里错了???错误报告:Traceback (most recent call last):File "C:/Users/Administrator/Desktop/test.py", line 18, in <module>SUM=sum(5)File "C:/Users/Administrator/Desktop/test.py", line 12, in sums=s+XUnboundLocalError: local variable 's' referenced before assignment
2 回答
慕容森
TA贡献1853条经验 获得超18个赞
12345678910 | def sum (X): s = 1 while 1 : s = s * X X - = 1 if not X: break return s SUM = sum ( 5 ) print SUM |
- 2 回答
- 0 关注
- 939 浏览
添加回答
举报
0/150
提交
取消