They have already started you off by offering the if statement. Your task was only to return a string, which is why it accepted the if statement answer but not the ternary operator.
The second choice would be considered if they had not started you off using an if statement.