Jinja getting the index value of the highest value in a list

Stuck with some jinja2 coding to get the index value for a highest value in a list.
What i am trying todo is the following:
I have 4 rooms with heating and a valve in each room, i’m using opentherm for the boiler.
For the opentherm to work correctly i need to input the setpoint and actual temperature, but i need to send the highest difference to the boiler. Otherwise it will start to lower its output temperature when the actual temperature reaches the setpoint.

So if the first room is set to 21 and actual is 20,8 the output could be 34 degrees.
But room 2 is set to 21 and is 19, so that room while the valve is open it wont heat up quickly.

So my thinking was to calculate all the differences and then decide with that what gets send to the boiler using the index value of the list i made with those differences

From my basic python skill i could do something like:

room1_delta = 4
room2_delta = 3
room3_delta = 1

delta_room = [room1_delta,room2_delta,room3_delta]
min_delta = min(delta_room)
x = delta_room.index(min_delta)

But no clue how todo that with jinja. Any ideas which direction is should look at?

the code is almost identical outside the keywords that jinja requires

{% set room1_delta = 4 %}
{% set room2_delta = 3 %}
{% set room3_delta = 1 %}

{% set delta_room = [room1_delta,room2_delta,room3_delta] %}
{% set min_delta = min(delta_room) %}
{% set x = delta_room.index(min_delta) %}

I feel really dumb now. Thank you

Jinja is basically python lite, with some changes here an there. Use the template docs to see what Home assistant adds, otherwise the internet is your best resource.