Will You?
Once Mary heard a famous song, and a line from it stuck in her head. That line was "Will you still love me when I'm no longer young and beautiful?". Mary believes that a person is loved if and only if he/she is both young and beautiful, but this is quite a depressing thought, so she wants to put her belief to the test.
Knowing whether a person is young
, beautiful
and loved
, find out if they contradict Mary's belief.
A person contradicts Mary's belief if one of the following statements is true:
- they are
young
andbeautiful
but notloved
; - they are
loved
but notyoung
or notbeautiful
.
Example
For
young = true
,beautiful = true
, andloved = true
, the output should bewill_you(young, beautiful, loved) = false
Young and beautiful people are loved according to Mary's belief.
For
young = true
,beautiful = false
, andloved = true
, the output should bewill_you(young, beautiful, loved) = true
Mary doesn't believe that not beautiful people can be loved.
Input/Output
[input] boolean young
[input] boolean beautiful
[input] boolean loved
Solution
def will_you(young, beautiful, loved):
return (young and beautiful) != loved
print(will_you(False, False, False))
print(will_you(True, True, True))
print(will_you(True, False, True))