Analysis of examination results.
passes = 0 # number of passes
failures = 0 # number of failures
studentCounter = 1 # student counter
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
print "Passed", passes
print "Failed", failures
if passes > 8:
print "Raise tuition"
Related examples in the same category