Получение UnboundLocalError в программе Python 3.8 - PullRequest
0 голосов
/ 31 марта 2020

Он продолжает выдавать UnboundLocalError: локальная переменная 'can_i_get', на которую ссылается перед присваиванием, прямо здесь.

            #this makes you have to have a certain level to get better weapon.  

    #ignore this --> 
             if player_level == (10,12):  #checks if there a high level
             can_i_get = True  #this checks if its True
            elif player_level == (1,9):  #checks if there not a high level
             can_i_get = False  #this checks if its False
            else:print("you cant use that ")  

             #this makes you able to get better weapons  



     # create a dictionary of the possible moves and randomly select the damage it does when selected

            if can_i_get: 
             What = {"ROOF": random.randint(18, 10000),
                     "Power Sword": random.randint(10, 21000), #this makes the damage random
                     "Mega heal": random.randint(20, 10000)} #why do i need to keep adding these?
...