Почему я получаю эту ошибку при запуске этого кода?
Traceback (most recent call last):
File "main.py", line 13, in <module>
def twoSum(self, nums: list[int], target: int) -> list[int]:
TypeError: 'type' object is not subscriptable
nums = [4,5,6,7,8,9]
target = 13
def twoSum(self, nums: list[int], target: int) -> list[int]:
dictionary = {}
answer = []
for i in range(len(nums)):
secondNumber = target-nums[i]
if(secondNumber in dictionary.keys()):
secondIndex = nums.index(secondNumber)
if(i != secondIndex):
return sorted([i, secondIndex])
dictionary.update({nums[i]: i})
print(twoSum(nums, target))
def twoSum(nums, target):
? - person ewong   schedule 18.08.2020list[int]
) ранее, вы можете сделать это, поместивfrom __future__ import annotations
в качестве первого импорта модуля (доступно в Python 3.7+ из-за PEP 563). - person Nerxis   schedule 19.04.2021