Trying to do this problem in Python: https://leetcode.com/problems/two-sum/ ...I have the following doubt... So far the code I have is this.
class Solution:
def twoSum(self, nums, target: int):
for i in nums:
for j in nums:
if i + j == target and nums.index(i) != nums.index(j):
print (nums.index(i), nums.index(j))
Specifically, the problem is that when iterating with the for loops the list that is entered, assuming that the list has 2 equal elements, only the first element is iterated, due to the characteristics of the lists, but I need to iterate all the elements even if they are repeated . Is there any solution or am I misapproaching the problem?