- 论坛徽章:
- 1
|
- #!/usr/local/bin/python
- def showMaxFactor(num):
- count = num / 2
- while count > 1:
- if num % count == 0:
- print 'largest factor of %d is %d' % (num, count)
- break
- count -= 1
- else:
- print num, "is prime"
- for eachNum in range(10, 21):
- showMaxFactor(eachNum)
复制代码
执行的时候出现错误,错误信息如下:
- %python program/python/maxfack.py
- File "program/python/maxfack.py", line 12
- count -= 1
- ^
- IndentationError: unindent does not match any outer indentation level
- %
复制代码
这个程序我是照《Python核心编程》这书里直抄的,我反复核对过书中的这代码了,没发现哪里不同!
初学的,不懂之原谅!
[ 本帖最后由 gtuiw 于 2008-8-8 10:43 编辑 ] |
|