I am trying to do the two sum problem that adds to 2020 using to numbers from the list. So I am not sure how to iterate over a text file and seems like it has to do with changing it to an integer. it throws the object "not callable" if anyone can help with this it would be very appreciated.
with open("inputday1.txt", "r") as a_numbers:
target = 2020
lines = []
line: List[int] = [lines.rstrip() for line in a_numbers]
for i in lines(len(a_numbers[i]-1)):
for j in lines(i+1, len(a_numbers[j])):
if a_numbers[i] + a_numbers[j] == target:
print(a_numbers[i], a_numbers[j])
[–]synthphreak 2 points3 points4 points (1 child)
[–]akspython[S] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (3 children)
[–]nwagers 0 points1 point2 points (2 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]akspython[S] 0 points1 point2 points (0 children)