So we can do the preliminary steps that will apply to both cases…

n = len(string) # n is int
m = n // 2 # floor divide for int
m += n % 2 # adjust for m is odd
return f"{string[:m]}greg{string[m:]}" # formatted string

In case anyone else came here in/after 2023 looking for help or alternative solutions, this is what I used (with explanations) to pass the exercise! This one tripped me up for longer than it probably should have, and my code is potentially a bit long (any constructive feedback is appreciated, keeping in mind I’m a beginner to coding!), but I’m happy with my code’s structure at the moment.

def gregs_e_tagger(string):
# The string will be split into two sections, part_1 and part_2, so that "greg" can be put in the middle later.
part_1 = ""
part_2 = ""
if len(string) % 2 == 0:
# If the length of the string is EVEN, this is how we find the midpoint of the string, and we construct the 'gregified' string
middle = int(len(string) / 2)
part_1 += string[:middle]
part_2 += string[middle:]
gregified_string = part_1 + "greg" + part_2
else:
# If the length of the string is ODD, this is how we find the midpoint of the string, and we construct the 'gregified' string.
middle = int((len(string) / 2) - 0.5)
part_1 += string[:middle]
part_2 += string[middle:]
gregified_string = part_1 + "greg" + part_2
return gregified_string