Big doubts in Arduino Flex Sensor Project

Good afternoon,
We have a school project that involves: arduino Uno, Flex Sensor 2.2, Resistors and 3 LEDs (green, yellow and red).
The Led´s should light up according to the flexion of the sensor, however there is always an error in the programming when testing.
Our function (tested on Tinkercad) is as follows:

#LedPin green 9
#LedPin yellow 5
#LedPin red 2
void setup ()
{
pinMode (yellow, OUTPUT);
pinMode (green, OUTPUT);
pinMode (red, OUTPUT);
Serial.begin (9600);
}
void loop ()
{
int sensor, degrees;
sensor = analogRead (0);
degrees = map (sensor, 768, 853, 0, 90);
Serial.print ("analog input:");
Serial.print (sensor, DEC);
Serial.print ("degrees:");
Serial.println (degrees, DEC);
if (sensor <580)
{
digitalWrite (yellow, LOW);
digitalWrite (green, HIGH);
digitalWrite (red, LOW);
}
else if ((sensor> 580) && (sensor <650))
{
digitalWrite (green, LOW);
digitalWrite (yellow, HIGH);
digitalWrite (red, LOW);
}
else
{
digitalWrite (red, HIGH);
digitalWrite (green, LOW);
digitalWrite (yellow, LOW);
}
delay (100);
}

Can anyone help us?
Thank you!

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

@natachavalador, do not hijack. Thread split.

#define green 9
#define yellow 5
#define red 2

however there is always an error in the programming

Describe the error(s) and post the messages.

Please read and follow the instructions in the "How to get the best out of the forum" post.