1 2 3 4 5 6 7 8 9 10 11 12 13
list = "this hack is whack hack".split() counter = 0 for i in list: if i == "hack": list[counter] = "*" * 4 counter = counter + 1 string = ' '.join(list) print string
1
this **** is whack ****