Is there a way to rotate two loops at the same time in python?

1

I was wanting to make a kind of game that you are going to buy some things that help you to make a profit, and you would have an amount that you earn per second, but I do not know if I can run two loops (one to make interaction with the player and the other to add an amount of money to the player per second) in python, if anyone knows, can you help me?

    
asked by anonymous 01.05.2018 / 05:45

1 answer

-1

You can use threads. Its use allows you to parallelize tasks in your program. If you use this solution, if there is any variable that is modified by more than one thread, I recommend that you create a lock. The reason is that, without a lock, the variable may assume a different value than desired.

  

link

     

link

    
16.08.2018 / 01:34