I need help/input on a homework assignment that I have. I already have a code that works but I was wondering if there was a simpler way to write the code to make it less lengthy