My code for a code challenge as follows: