Я только начал изучать ООП и борюсь с ним. Этот вопрос, вероятно, смотрит мне прямо в глаза.«Глобальное имя не определено» error
def Travel():
choice = str()
choice = input("Where will you search?\nChoose F for Front or T for Trunk\n")
if choice == "F":
LocF()
elif choice == "T":
LocT(i)
def LocF():
print("Looking through the front of the car, you find a screwdriver.\nYou figure that might help a bit.")
inv = ("screwdriver")
return i
def LocT(i):
if i[0] == "screwdriver":
print("You use your screwdriver to pop the inside of the trunk door lock off.")
time.sleep(0.5)
print("You make it to class with seconds to spare.")
else:
print("You can't get to the trunk yet.")
Travel()
Вы не определили i ... –
в 'LocF()', вы создаете переменную 'inv', но пытаетесь вернуть несуществующую переменную' i'. Измените одно на другое. –