Session 3 Homework

Session 3 Homework for Salim Hamed.
I'd put these in separate functions, so as to keep the code a bit cleaner, but all the logic looks good.