Try this:
def reverse(input_str):
new_str = input_str.replace(' ','').replace('*','')[::-1]
index = 0
for c in input_str:
if c == ' ' or c == '*':
new_str = new_str[:index] + c + new_str[index:]
index +=1
return new_str
txt = "I* Am Not String"
print(txt)
print(reverse(txt))