Added Python solutions to problems 6 & 7 + Minor refactoring