c/c++栏目中类和对象-4的python实现

# -*- coding: utf-8 -*-
"""
Created on Wed Jun 04 01:21:31 2014

@author: Administrator
"""

class Analysis:
    def processExamResults(self):
        passes = 0
        failures = 0
        studentCounter = 1
        
        while(studentCounter<=10):
            result = input("Enter result( 1 = pass, 2 = failure ):")
            
            if(result == 1):
                passes = passes + 1
            else:
                failures = failures + 1
            
            studentCounter = studentCounter + 1
            
        print Pass: , passes
        print Failure: , failures
        
        if(passes>= 8):
            print Raise tuition!\n

myAnalysis = Analysis()
myAnalysis.processExamResults()

 

c/c++栏目中类和对象-4的python实现,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。