It's always a good idea to include in your question what you tried. Anyways,
here's an example you can check out and compare with your attempt.
If you still don't understand what your mistake was, send your function and I can take a look at it.
Hope this helps!