Your computer uses the stored program model. This means the instructions for each program are stored as files on the hard drive.
When you are writing Python code, you create a .py file that stores all the instructions.
You then tell the computer to later execute that code.
It will follow the instructions, but this time on whatever new input it gets from the user that time.