码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2014-06-06 13:03:57      阅读:354      评论:0      收藏:0      [点我收藏+]

标签:c   style   class   blog   code   java   

bubuko.com,布布扣
# -*- 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()
bubuko.com,布布扣

 

c/c++栏目中类和对象-4的python实现,布布扣,bubuko.com

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

标签:c   style   class   blog   code   java   

原文地址:http://www.cnblogs.com/tmmuyb/p/3766806.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!