Pet engineer, code doesn't work

Hi @K_P, welcome to the Discourse!
After following the link in @Yisrael_Hefter’s reply, please learn how to format your code correctly, then reformat your code so that it’s easier for us to help you and post it in a new reply (or edit your previous response and tag me @MarmiteOnToast to get my attention).