You want to consider all values of j for each value of i. zip() doesn't do that, it just considers aligned pairs from each list, i.e., matching values of i and j. You need a nested loop, like this:
nums=[2,7,11,15]
target=9
b=len(nums)
for i in range(b):
for j in range(b):
if nums[i]+nums[j]==target:
print(i,j)
You can simplify it a little by using enumerate() to get indexes and values together:
nums=[2,7,11,15]
target=9
for i, n in enumerate(nums):
for j, m in enumerate(nums):
if m + n == target:
print(i,j)
There are various ways you could speed it up:
You could consider only j Indexes greater than or equal to i, and then print out both i, j and j, i when you get a match.
If you know nums is sorted, you can make it a lot faster by using a while loop that counts up from the bottom and down from the top. This would report matches when it finds them and raise the bottom counter when the sum is too low or lower the top counter when the sum is too high.
If nums is not sorted, a dictionary-based solution like @deepak-tripathi's will be most efficient. Both that and the shifting-bounds solution have O(n) solution times (vs. O(n^2) for the nested loops) and the dictionary-based solution is easier to write correctly (e.g. to handle duplicate values) and can handle sorted or unsorted lists..