As print
is a function in Python3, you can reduce your code to:
while item:
split = item.split()
print(*map(function, split), sep=' ')
item = input('Enter a sentence: ')
Demo:
$ python3 so.py
Enter a sentence: a foo bar
at foot bart
Even better using iter and partial:
from functools import partial
f = partial(input, 'Enter a sentence: ')
for item in iter(f, ''):
split = item.split()
print(*map(function, split), sep=' ')
Demo:
$ python3 so.py
Enter a sentence: a foo bar
at foot bart
Enter a sentence: a b c
at bt ct
Enter a sentence:
$