Every person who attempts to commit an offense, but fails to commit or is prevented from committing it, shall, where it is not otherwise provided, be punished as follows:
(1) If the offense attempted be punishable with life imprisonment, the person making such attempt shall be guilty of a felony and, upon conviction, shall be imprisoned in the penitentiary not less than three nor more than fifteen years.
(2) If the offense attempted be punishable by imprisonment in the penitentiary for a term less than life, such person shall be guilty of a felony and, upon conviction, shall, in the discretion of the court, either be imprisoned in the penitentiary for not less than one nor more than three years, or be confined in jail not less than six nor more than twelve months, and fined not exceeding $500.
(3) If the offense attempted be punishable by confinement in jail, such person shall be guilty of a misdemeanor and, upon conviction, shall be confined in jail not more than six months, or fined not exceeding $100.