I want to create a function that takes as an input a string which is a text, and I want to capitalize every letter that lies after a punctuation. The thing is, strings don't work like lists so I don't really know how to do it, I tried to do this, but it doesn't seem to be working :
def capitalize(strin):
listrin=list(strin)
listrin[0]=listrin[0].upper()
ponctuation=['.','!','?']
strout=''
for x in range (len(listrin)):
if listrin[x] in ponctuation:
if x!=len(listrin):
if listrin[x+1]!=" ":
listrin[x+1]=listrin[x+1].upper()
elif listrin[x+2]!=" ":
listrin[x+1]=listrin[x+1].upper()
for y in range(len(listrin)):
strout=strout+listrin[y]
return strout
For now, I am trying to solve it with this string: 'hello! how are you? please remember capitalization. EVERY time.'