Dec-17-2017, 08:22 PM
Finally....it works! Thank you for all your help!
def match(Home, Visitor, matchnum): print("Match", str(matchnum)) scorehome = int(input("Enter the number of points "+Home+" got in Match "+str(matchnum)+": ")) scorevisitor = int(input("Enter the number of points "+Visitor+" got in Match "+str(matchnum)+": ")) return scorehome, scorevisitor return wrong_score(scorehome, scorevisitor) def printScoreCard(Home,Visitor,winhome,winvisitor): print(Home,winhome) print(Visitor, winvisitor) def wrong_score(scorehome, scorevisitor): if (scorehome > scorevisitor and scorehome < 25): print("One team must score 25 points. Please enter scores again.") return False elif (scorevisitor > scorehome and scorevisitor < 25): print("One team must score 25 points. Please enter scores again.") return False elif (scorehome > scorevisitor and scorehome - scorevisitor < 2): print("One team must win by 2 points. Please enter scores again.") return False elif (scorevisitor > scorehome and scorevisitor - scorehome < 2): print("One team must win by 2 points. Please enter scores again.") return False else: return True def startgame(): print("Welcome to the volleyball score program.") Home = input("Enter the home team's name: ") Visitor = input("Enter the visitor's team name: ") winhome = 0 winvisitor = 0 for i in range(5): while True: scorehome,scorevisitor=match(Home, Visitor,i+1) if wrong_score(scorehome, scorevisitor): if scorehome > scorevisitor: winhome=winhome+1 else: winvisitor=winvisitor+1 break printScoreCard(Home,Visitor,winhome,winvisitor) if winhome>winvisitor: print(Home+" wins the game!") else: print(Visitor+" wins the game!") startgame()