Can anyone help me improve my code?
I am worried as the game goes the ram usage will increase, which will slow down the performance, so I tried to delete car objects. But my code only removes them from the list total, but not actually deletes them.
The main problem I see is that you have 3 for loops that iterates over the cars. You have one in
cars.remove_cars(), and on line 46. What you can do instead is to just use one for loop for your cars:
Your class design pattern is also a little weird. You should have a class for a car, not a class for all the cars, but, that's something else
Hope this helps :)