程序设计思想与方法python讲义第六至十三章.ppt

程序设计思想与方法python讲义第六至十三章.ppt

def printReport(self): n = self.winsA + self.winsB print Summary of, n , games: print print wins (% total) shutouts (% wins) print -------------------------------------------- self.printLine(A, self.winsA, self.shutsA, n) self.printLine(B, self.winsB, self.shutsB, n) def printLine(self, label, wins, shuts, n): template = Player %s: %4d %5.1f%% %11d %s if wins == 0: # Avoid division by zero! shutStr = ----- else: shutStr = %4.1f%% % (float(shuts)/wins*100) print template %

文档评论(0)

1亿VIP精品文档

相关文档