so I made a simple game where boxes fall from the top of the screen and you have the dodge them from the bottom of the screen. When a box falls to the bottom of the screen without hitting you get a point.
The part I'm struggling with is how to change the score variable. For now, I have two for loops looping through a dictionary where I stored all my bullet instances, once when updating the bullets and the other for checking if a bullet has touched the ground and if it did, score += 1. I don't really like this structure because looping through the exact same dictionary twice seems stupid and might slow down the speed with much more complex programs. The problem is that the updating loop is inside my Bullet class and the other is in the main game function, with score as local variable.
A solution to this would be to change score to a global variable but I want to keep the variable in the game function since it's a variable that belongs to the game and also, the guy who taught me python told me to avoid global variables, and try to pass variables through functions