I don't understand my mistake

I’m new here and I need help.
I try to solve a palindrome(?) problem (anna can be read in both ways)

phrase = "anna"
#Vérifier le nombre de lettres
x = len(phrase)

mot_1_inversé = ""
if x%2 == 0:
    y = x/2
    mot_1 = phrase[0:y]

TypeError: slice indices must be integers or None or have an index method

I don’t know what is wrong…
Thanks for your help

Division operator it python returns float type as the result. So your y = x/2 is float.
As the error says - your ‘y’ is not integer, it’s float. You cannot use float for slices phrase[0:y]
You can check type by printing type(y)

To fix it use y = int(x/2)
or y = x//2

Thanks !
It works !