My Python Array Resets Every Time I Run it

Assuming you run this code through the python interpreter your array (they’re lists in python, arrays can be created using python modules) will be removed from memory when the script ends, you will need to save the values to a file or through some other method. You could try to add a while loop to the code in order to keep prompting the user to input until they quit the program.

As a side note; even if the array was still saved to local memory when the script ended, you are resetting the list in the first line journal=[].

Leave a Comment