Upon the trial of an indictment or information, the defendant may be convicted of the crime charged therein, or of a lesser degree of the same crime, or of an attempt to commit the crime so charged, or of an attempt to commit a lesser degree of the same crime. Whenever the jury shall find a verdict of guilty against a person so charged, they shall in their verdict specify the degree or attempt of which the accused is guilty.