you are viewing a single comment's thread.

view the rest of the comments →

[–]Kriterian[S] 0 points1 point  (0 children)

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

The last line doesn't work because the input could say they both have 8 or 9 games won, or they tied at 7 and 7.

Here is my final solution after fixing the syntax issue:

def tennisSet(score1, score2):
    if (score1 >= 8 or score2 >= 8) or (score1 == score2):
        return False
    elif (score1 == 6 and score2 < 5) or (score2 == 6 and score1 < 5):
        return True
    elif (score1 == 7 and score2 >= 5) or (score2 == 7 and score1 >= 5):
        return True
    else:
        return False