I don't understand the purpose of this function, for example if I run: strangelt("Hello World", 3, "Bye")
I get the output: HeByeByeo WorByed What is the common use case for this? And would it not be simpler and faster to implement it with this 1 liner: def strangelt(s,j,m): return s.replace(s[j], m) On Sun, Aug 28, 2022 at 10:29 PM Kiruthik.M.R 11-B <kiruthik1...@gmail.com> wrote: > Greetings, I'm Kiruthik from India. I've been studying coding for the past > two years. I know that strings are immutable in Python. But, most of the > people can't change the elements in the string as default. So, I came up > with a solution by creating a function called *strangelt. *This function > has three parameters in it and works faster. It has the ability to get a > string from the user and make changes to the element of the string using > index values. I found that it would be a pretty good solution for people's > problems. I hereby kindly request you to include this function in Python > built-in libraries from the release of the next version. > > Expansion of strangelt: *str*ing+ch*ang*e+*el*ement > *Syntax:* > *string_variable=strangelt(string,index,new value to be replaced)* > > Thank You, > Kiruthik. > _______________________________________________ > Python-Dev mailing list -- python-dev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/DTJRUMDJLL5WLJZKMRKEE7OGAFZIIXFW/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/DX6IPXSLG6TM7YWQGEZWLWTUTR2LPXMB/ Code of Conduct: http://python.org/psf/codeofconduct/