The code that you posted is not the usual Arduino code (which is written in C++).
Which board are you using?
Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advice on) your project See About the Installation & Troubleshooting category.
This looks like Python. Are you trying to use Circuitpython? If so, then I would suggest you go to https://circuitpython.org/ and check out their forum.
I suggest you look on the tinygo website (tinygo.org) for help with that code. The Arduino IDE is based on C++, which is very different. You are not going to be able to use the Arduino IDE to compile the code you posted.