String comparison gotcha

Question Q2.3.5

Consider the following (incorrect) tests to see if string s has one of two values. Explain how these statements are interpreted by Python and give a correct alternative.

>>> s = 'eggs'
>>> s == ('eggs' or 'ham')
True

>>> s == ('ham' or 'eggs')
False

Solution Q2.3.5