your question looks like a candidate for
Code Review, not SO. you say your code works, so there is no
error as such. -- such issues being in your code means you should to work on it more. you don't need anyone to point the simplest ones out. -- you
should use ChatGPT/Copilot for assistance with your code. if you use any of its output (code, text), make sure to understand what it wrote, and make sure it's actually making sense. many users just get it to generate code for them, and then they ask
us people to explain it to them. if you use generative AI, you take responsibility. —
Christoph Rackwitz 33 secs ago