You weren't that far off with your first attempt. You've actually got the answers before.
I see 3 problems with the initial code and I'll point them out so you can understand what went wrong before:...