Quick OCaml Question!

I have two ways to solve this problem. First, the tutor directly gives the code answers you think are correct. Second, I have an answer I wrote myself that I think is correct, but it shows “syntax errors”. You can try to modify it, and then decide whether to provide an answer yourself.Regardless of which method, I only need one result, your code must completely pass the test code scoring website given by the professor.