Remove spaces from a string
Write a function named remove_spaces that takes a string text as input and returns a new string with all space characters (" ") removed. Use a for loop.
Remove only the ordinary space character (" "). Preserve tabs, newlines, and all other characters.
Complete the supplied function in Listing 1. Keep its signature and use the checks below it.
TipHint
len(text) returns the number of characters, so len("cat") is 3 and len("") is 0. A for loop over a string visits its characters in order. String indexing starts at 0, so "cat"[0] is "c"; the index must refer to an existing character.
assert condition stops the check with an AssertionError when the condition is false.