r/learnpython • • Oct 02 '26

Slow print for text-based game

I am trying to make a text-based adventure game in Python, how do I make it so the text is typed out slowly and not instantly? I've tried ways online, but they keep returning None at the end. How do I fix this?

0 Upvotes

15 comments sorted by

View all comments

6

u/desrtfx but other languages pro Oct 02 '26

but they keep returning None at the end

You cannot achieve that with a returning function.

You need to iterate over the string character by character and print with a delay. Python's print can use an empty endline so that everything prints in a single line.

0

u/while_True_meme Oct 03 '26

Unless you print the result. The confusion could come from using a Python repl where the return value is indeed printed vs running a script where it's not