A Python snippet utilizing the LEGO EV3 colour sensor, the LEGO EV3 Brick and Pybricks. Pybricks is the LEGO recommended method of using the LEGO EV3 Brick with Python. See the official Python for EV3 LEGO page for more details.
This example changes the colour of the EV3 Brick based on the colour sensor.
The documentation for Pybricks is really helpful:
https://docs.pybricks.com/en/latest/ev3devices.html