Replace character to "@" in string

Why python does not replace last character for @?

str_manip = input("Enter a sentence ")
last_char = str_manip[-1]
print(last_char)
change_char = str_manip.replace("last_char", "@")
print(change_char)

It comes up as exactly the same sentence as I enter, unchanged.

I have read a few websites and still do not understand. I thought maybe it was because @ is char but str() doesn't help, saving it as separate string variable also doesn't work.



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Network Error and Timeout on Authorize.net JS

Spring Elasticsearch Operations