def precedes(w1, w2): if w1.count() > w2.count(): return True elif w1.count() < w2.count(): return False elif w1.word() < w2.word(): True else: return False
precedes(w1,w2)
should return True
if w1
(a word) has a count that's greater than w2
. Ties are resolved in favor of the word that is lexicograhically less.
I found that tie resolution wasn't working. I convinced myself that I must have gotten a w1
/ w2
reversed, or a conditional operator backwards. I looked and looked at those three comparisons but just couldn't find anything wrong with them.
*Golf discs are about 8.5" in diameter and are often made of bright-colored plastic.