Censor question about split() function


Hey guys I just had a question about the split() function. The code below gets me the solution.

When I used text.split(' ',1) instead, upon printing z, I'd get z = ['hey', 'hey hey']. So that was why I wasn't getting the solution as it wasn't splitting up the text properly.

So I wanted to know what is different about the two forms of .split I used. I thought .split(' ',1) is sorta the default anyway, and writing split.( ) is just easier, but apparently they're different.

def censor(text,word):
    z=text.split( );
    for i in range(0,len(z)):
        if word == z[i]:
    return ' '.join(z);



I encourage you to always read the docs to figure out such answers :wink: