首页 > 代码库 > c/c++栏目中类和对象-4的python实现
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()
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。