use conditional operator in grade()