import math test_a = "Hallo_Welt" test_b = "Hell_Planet" def slice(txt): l=len(txt) for i in range(1,l): if i<=l: print(f"{txt[:i+1]} {round(i/2)}" ) else: print(txt[i]) print(slice(test_a))