Attempt murder as a category B felony carries two to twenty (2 - 20) years in state prison. The judge will impose an additional one to twenty (1 - 20) years if either:
the defendant used a deadly weapon, or the victim was age 60 or older
That's 40 years.
Death penalty (only if there are aggravating circumstances that outweigh any mitigating circumstances), or Life in prison without the possibility of parole, or Life in prison with the possibility of parole after 20 years, or 50 years in prison with the possibility of parole after 20 years
That's 20 years unless you get life (which only about half do).
Why is attempted murder More likely to get 40 years?
I think it's because the attempted murder victim would be around to annoy the police therefore the sentence must be longer.