I'm currently making a text-based strategy game with python, but I've come across a problem, I want to make the user receive 1 gold and lose 5 food every 10 seconds, so I made a loop:
import time
gold = 0
food = 100
while True:
    time.sleep(10)
    gold += 1
    food -= 5
But I can't run the main loop now because the program is stuck running the first one:
while True:
    what_to_do = input("What do you want to do?\n")
    if what_to_do == 'wood':
        wood()
    ...
I there any way I can constantly add gold and lose food at the same time as being able to play the game? Such as being able to run a loop in the background while the main loop runs, or am I just being stupid?
