Skip to contentKEEP THE CRAFTTHE SANCTUARY

Tokenize Words

Split text into a list of lowercase words on any whitespace.

The problem

Implement tokenize(text). Split text into words and return them as a list of lowercase strings, in the order they appear. Words are separated by any run of whitespace (spaces, tabs or newlines), and the list never contains empty strings. For example, "One TWO\nthree" gives ["one", "two", "three"], and a string of only spaces gives [].

Starter code

def tokenize(text):
    pass

Public examples

  1. text = "One TWO\nthree"gives["one", "two", "three"]

Solving it in the practice book needs an active paid plan.

Open it in the practice book
One thought at a time.