Ghpyton, vb or c# in grasshopper

Hello everyone,
I need help in the following problem:
I prefer to use the GHPython language to solve the problem

#How can I do the following code auotmaticlly
#where I have to get the value N from the absloute difference between the varaibels x and y

are x,y the variabels as integer which I will change all the time for a parmetric study

Here is the relationship between the variabels x and y and the output N

if abs (x-y) = 0 or 1 :
N = 1
if abs (x-y) = 2 or 3 :
N = 2
if abs (x-y) = 4 or 5 :
N=3
.
.
.
#until big N nummber like 1000

Hello,

N = (abs(x-y) + 2) // 2  # integer division
maximum = 1000
N = min (N, maximum)

-Graham

2 Likes

Thanks Graham. Now everything works correctly
Have a nice day