I need to know how to pass the invalid_input_count to the run_todo function it just errors and says Unresolved reference 'invalid_input_count'
import sys
todo_list = [
"go shopping",
"do homework",
"do excercise",
]
invalid_input_count = 0
def run_todo():
wanna_run = input("Would you like to run the to do list programme?\nYes or No? ")
if wanna_run.lower() == "yes":
print(*todo_list, sep = ", ")
add_or_remove = input("Would you like to add or remove an instruction?\nadd or remove?")
elif wanna_run.lower() == "no":
print("See you later!")
sys.exit()
else:
invalid_input_count += 1
while invalid_input_count <= 3:
print("Invalid input! You have " + str(3-int(invalid_input_count)) + " attempts left.")
run_todo()
else:
print("Too many invalid inputs!\nShutting down...")
sys.exit()
run_todo()