To separate words and make them lowercase in Python, you can use the split()
method to break a string into a list of words, then use lower()
method to convert each word to lowercase. Finally, you can join the words back together using the join()
method.
Here's an example:
main.py286 chars15 lines
In this example, we first call lower()
function on my_string
to make all the letters lowercase. We then call split()
on the result, to break the string into a list of words. We cast the resulting list of words into lowercase and then join them back together into a lowercase string using a space as a separator with join()
. Finally, we print the resulting lowercase string.
gistlibby LogSnag