这个Python程序怎么进入死循环了?

这个Python程序怎么进入死循环了?

#initialize variables
passes = 0  #number of passes
failures = 0 #number of failures
studentCounter = 1 #student counter

#process 10 students;counter-controlled loop
while studentCounter <= 10:
    result = raw_input("Enter result (1=pass,2=fail):")
    result = int( result ) #one exam result

if result ==1:
    passes = passes + 1

else:
    failures = failures + 1

studentCounter = studentCounter + 1

#termination phase
print "Passed",passes
print "Failed",failures

if passes >8:
     print "Raise tuition"

就是输入10个统计值后,输出passed和Failed的人数,大于8就输出Raise tuition.是Deitel写的Python 编程金典上的例子,看的是pdf版,不是很清楚。请指点。谢谢。
while studentCounter <= 10:
    result = raw_input("Enter result (1=pass,2=fail):")
    result = int( result ) #one exam result
    studentCounter +=1
典型缩进产生的问题哇

[Copy to clipboard] [ - ]
CODE:
if result ==1:
    passes = passes + 1

else:
    failures = failures + 1

studentCounter = studentCounter + 1

这块再缩进, 与result = int( result )同缩进。

我试了下,要把你们的方案结合起来,才有正确的输出。用了两个例子,都是对的


QUOTE:
原帖由 askQLiang 于 2007-10-11 16:52 发表
studentCounter = 1 #student counter

#process 10 students;counter-controlled loop
while studentCounter <= 10:
    result = raw_input("Enter result (1=pass,2=fail):")
    result = int( result ) #one exam result
..

很明显的是个死循环阿 ..  

studentCounter  一直都是小于10的,

下面加个 studentCounter ++  就OK了
#initialize variables
passes = 0  #number of passes
failures = 0 #number of failures
studentCounter = 1 #student counter

#process 10 students;counter-controlled loop
while studentCounter <= 10:
    result = raw_input("Enter result (1=pass,2=fail):")
    result = int( result ) #one exam result

    if result ==1:
        passes = passes + 1
    else:
        failures = failures + 1
    studentCounter = studentCounter + 1

#termination phase
print "Passed",passes
print "Failed",failures

if passes >8:
     print "Raise tuition"