data = 'Hi, Welcome to MK training. I love python.'

words = []
word = ''

# loop through each character
for x in data:

    print('Processing ' + x)

    # if character is a separator and if word variable has something in it
    # then store it in words list
    if x in [',', '.', ' ']:
        
        print('!! Found a separator !!')

        if word:
            print(f'Adding the word "{word}" to {words}. Resetting word.')
            words.append(word)
            word = ''
            print(f'Words is now {words}')

    else:
        word += x
        print(f'Word is {word}')

# after looping through all characters, if there's still something
# in word, store it in words list
if word:
    words.append(word)

print(words)
