I defined the 'timesUsrPlayed' variable outside of the funcion so it does not reset it. When I add 1 to the variable I get yellow wiggle lines under the times I call the var 'timesUsrPlayed' in the function 'randomPartOfGame'. when i hover over the lines it says '"timesUsrPlayed" is not defined Pylance(reportUndefinedVariable)'. I really hope I said that clearly:
import os
import random
# a funcion to clear the console
clear = lambda: os.system('cls')
# counts the plays
timesUsrPlayed = 0
def randomPartOfGame():
n = random.randint(0,6)
p = random.randint(0,6)
print(str(n) + " and " + str(p))
if n != p:
print("im sorry try again")
randomPartOfGame()
timesUsrPlayed += 1
elif n == p:
print("yay you did, it took you "+ str(timesUsrPlayed) +" times to get a double")
def mainGameFunction():
print('game starting...')
time.sleep(2)
clear()
print('welcome you need to get a double in dice (is means get the same number)')
randomPartOfGame()