Ask coding questions

← Back to all posts
Storing in Python

“Ignore the Rock Paper Scissors program below.”

So somebody asked me a question today about storing a function in python saying, “Do you happen to know how I could add a save function? i just can't seem to figure it out,” JacobN1. After being asked this, I figured they had not meant storing an input or variable for the program but rather “forever.” So if you were to reload the page, the program would still store that number in for num1. At first, I thought, well that’s pretty much impossible for multiple reasons, however after doing a bit of research, I stumbled upon many ways of possibly doing this with the help of StackOverflow (the goat). I learned about these things called “shelves” and “pickles,” but I was still so confused on how this worked, if at all. I knew repl ran on servers rather than your 500 dollar laptop off Amazon you bought a year ago for quarantine and mostly used it for school on zoom but anyways, if repl runs off servers, that would mean that the servers would have to be running 100% of the time, which it is not because I do not have the hacker plan. And if it’s not running, it’s not saving. This made me confused as in a dream and made me question if this is possible or not. Any answer would be greatly appreciated. Thanks for listening to my Ted talk. Have a great day,


Answered by Coder100 [earned 5 cycles]
View Answer

whats ur question

anyways the pickles and stuff they are stored in files, and won't save not because of what you said but because of security.

Try using replit db!


Is there a way to store a variable and keep it there when reloaded? @Coder100
I enter a number and it stores it for num1
I reload the page and num1 is still stored in for the number entered before.


The program is below.

And couldn't you reply to their question instead of creating a new post?


I did realize the program is below. Btw, they were asking me if I knew the answer to their question, which was “how to save variables when reloaded” which I didn’t know the answer to. That is why I asked it here. @cdCreepArghhh


@CodeMaster007 Oh ok that makes sense.