1sample_string = "712345677890 173445667"
2# if i wanted to do:
3new_string=sample_string.replace("7", r)
4print new_string
5#you won't get your results
6#Output:
7r123456rr890 1r344566r
8#but i wanted it to be
9712345677890 17344566r
10#there are different methods of solving this problem but i use this one
11new_string=sample_string [:-1] + "r" # you can make change the amount of last letters getting replaced like for example the last three letters you would change [:-1] to [:-3]
12#Output:
13712345677890 17344566r #yay this is it