The Raspberry Pi needs an OS before you can program it with any custom scripts. The official operating system for the Pi is known as Raspberry Pi OS (formerly Raspbian). The Raspberry Pi OS can be installed using the Raspberry Pi Imager application. This software is used to write almost any OS image onto an SD card for the Raspberry Pi. You can read more about how to install Raspberry Pi OS in our guide.
There are many ways to go about programming the Raspberry Pi with Python being the most popular option. There are tons of Python libraries available online that make it easy to start programming hardware. The Raspberry Pi OS comes with some pre-installed, including the GPIO Zero Python library, which you can read more about on the Raspberry Pi website.