Encuentre la diferencia entre dos números triangulares Python

#difference between triangular numbers

num1 = n=9
y=((n**2)+n)/(2)   
print (y)

num2 = n=6
y1=((n**2)+n)/(2)   
print (y1)

num1 =y
num2 =y1


if num1 > num2:
    diff= num1 - num2

else:
    diff= num2 - num1

print('The difference between 9th and 6th triangular numbers =',diff)
Travinth Dayalaeaswaran