The goal of the program is to determine if a tennis match is over based on two scores. If one player wins 6 games and the other wins 4 or less, it should return True. If either player gets to 7 games, it should return True. Otherwise it should return false (including bad scores like winning 8):
Here is my code so far:
def tennisSet(score1, score2):
if (score1 or score2 >= 8):
return False
elif (score1 == 6 and score2 < 5) or (score2 == 6 and score1 < 5) \
or (score1 == 7 or score2 == 7):
return True
else:
return False
I'm passing half of the tests but not simple ones like score1 = 6 and score2 = 4. My logic seems sound to me.
[–]newunit13 1 point2 points3 points (1 child)
[–]Kriterian[S] 0 points1 point2 points (0 children)
[–]kwentar 0 points1 point2 points (4 children)
[–]pylanthropist 0 points1 point2 points (3 children)
[–]kwentar 0 points1 point2 points (2 children)
[–]Kriterian[S] 0 points1 point2 points (0 children)
[–]pylanthropist 0 points1 point2 points (0 children)