This is because there is no return statement.
There are other issues that need to be resolved.
text is already a string, for starters.
A more descriptive variable would be,
char, since we are iterating over a text string one letter at a time.
for letter in text:
This line conflicts with,
As mentioned, this line,
should not be there. Let the loop complete then return the new text.
Short of writing a solution for you, the best thing to do is re-think this problem and do it over from scratch.