In this article, we will see how to remove a white space character from a string and convert the string to upper case.
By using the split() method we divide the entire string into multiple substrings with whitespace as a delimiter. By default split() uses a white space character as a delimiter.
With join(), we join all the sublists together to get the final string without any spaces.
With upper(), we convert the string to upper case characters which gives the final result.
string = r"How are you?"
# Split the list with white space and join all the sublists together
foo = ''.join(string.split())
# convert to the upper case
foo = foo.upper()