I am making a program that simulates a stock market for a virtual currency. I have not tried anything yet, but I want a Python script to run 24/7 online for a long period of time. The python script should be something like this:
import time
import random
while True:
number = random.randint(0,5)
print(number)
time.sleep(2)
Also, a separate local Python program should be able to retrieve the number
variable constantly every 2 seconds. I do not need a recommendation for a product or service. I just need to know what code I need to run and if I need a physical or web server.
If I use a web server, I will be paying monthly for a long time. This project needs to be running online for theoretically years (setting aside downtime and maintenance).
I have barely any experience in servers and networking, and I couldn't find answers online. Again, I have not tried anything yet.