The end parameter in the Python print() function controls what is printed at the end of the output.
By default, print() appends a newline character (\n), so each print() call starts on a new line. 1
You can change this behavior by specifying a different value for end.
It's useful for real-time effects, like typing animations or progress bars, where you want each part of the output to appear instantly.
Normally, the output of print() is buffered
This means Python waits to accumulate more data before actually displaying it in the terminal (especially in interactive programs).
flush=True forces Python to immediately display the output without waiting.
What do we need to accomplish with this effect?
We want to write a message
Change the message to include dots after it, which keep growing the longer it runs
Write everything on the same line (rewrite the line before it)
We print the message
Sleep to simulate thinking
Write the next message (which is longer) on the same line
using the end = "\r"
Keep repeating