just getting started in Python and I'm writing a program that checks for alerts, basically I need it to keep track of a number and if the next loop that number is higher, then do stuff.

```
def code():
yellowCount = 0
orangeCount = 0
redCount = 0
blueCount = 0

print ("----------------------------------------")
print ("Running check on ")
# do your stuff
for line in open(txtFiles[0]):
    if 'details_YELLOW' in line:
        yellowCount = yellowCount + 1
    elif 'details_ORANGE' in line:
        orangeCount = orangeCount + 1
    elif 'details_RED' in line:
        redCount = redCount + 1
        toaster.show_toast("xxxxx","Red alert detected on ")

    elif 'details_BLUE' in line:
        blueCount = blueCount + 1
print (str(yellowCount) + " Yellow alerts")
print (str(orangeCount) + " Orange alerts")
print (str(redCount) + " Red alerts")
print (str(blueCount) + " Blue alerts")

```

There's a code excerpt, what's the best way to go about this? Global variables? Basically I only want to alert if there's a NEW alert, not notify for every single alert detected every time the code runs.

Example of Code Output

```
==================
Downloading Alerts
==================
----------------------------------------
Running check on 
0 Yellow alerts
0 Orange alerts
0 Red alerts
0 Blue alerts
----------------------------------------
Running check on 
0 Yellow alerts
1 Orange alerts
0 Red alerts
0 Blue alerts

```

So I want to execute code only if the orange alerts goes to 2 on the second for example