0
I want to be able to apply several String Methods to the same String in Python. How do I do this?
So instead of coding string_name.capitalize() and string_name.casefold() and string_name.count('a'), I want to use string_name.x, where x = capitalize() and then reassign x to x = casefold, then x = count('a') and so now. Maybe even assign an input to x so you could enter in what method you want to apply to a string.
2 ответов
+ 5
Is this JavaScript?
Also I didn't really understand your purpose I'm sorry
0
It is for python. I edited that into the original post. Thank you, I forgot to mention that. I want to write a program that shows an example of each String method and the help documentation. I realized I was writing the same code over and over except for the method. Here is an example of what I've done so far:
https://code.sololearn.com/cVojC4oT1Z3G/?ref=app
I am trying to make a function that produces the same effect, but it won't let me use a parameter in place of the method:
https://code.sololearn.com/c4nOCGaSSI13/?ref=app