-2

I have a string and I know it includes the word "python" but I don't know how many characters the string has. I want to add "." before "python" for example:

     str = input("enter string")
     #Here I need help
     print(str)#The output will be the user's input and "." before the word "python" let say str = "I love python" the output will be "I love .python"

1 Answers1

1

I didn't exactly get your question but look at this, maybe it'll help.

inp=input('enter input ::')  # taking user input

new_str=inp.replace('python','.python') #just replace python will .python in user input

print(new_str)

The output will be like :

enter input ::i love python
i love .python