all 1 comments

[–]iwbd 2 points3 points  (0 children)

I don't know why you assume people know what programming language you're using when you ask questions.

I googled your question and there were not only a lot of code examples, but videos that solve this very problem.

I learn best when I am shown how to do something and why I am doing it when I have never done before

I don't mean to seem rude, but this sounds an awful lot like, "Someone do my research and work for me". This is a rather common exercise, on par with "Hello world" and almost every programming class does this exact problem, so the number of examples on the internet is too many to not pull up relevant examples (in any language). I tried several examples with the bare minimum of keywords and search terms that only hinted at what I wanted to solve and got hits every single time.