Help with script for air condition

Hi all
I have the following script (in a button) in order to manually turn on the air condition
I need to change the desired temperature depending what is the outside temperature.
something like
if sensor.outdoor_temperature_2 <= 11 temperature = 21 else 19
Can someone point out how to implement this please?

aircon_margarita_heat:
  alias: AirCon Margarita Heat
  sequence:
    - service: climate.set_temperature
      data:
        entity_id: climate.kid_ac
        hvac_mode: 'heat'
        temperature: 19
    - service: climate.set_fan_mode
      data:
        entity_id: climate.kid_ac
        fan_mode: mid

Try this:

- service: climate.set_temperature
      data:
        entity_id: climate.kid_ac
        hvac_mode: 'heat'
        temperature: "{{ 21 if states('sensor.outdoor_temperature_2') | int < 11 else 19 }}"

That’s it . Thanks a lot.
From now on I will remember that there is this possibility too.