Can you help me improve this Python code?
Given a list of numbers and a number k, return whether any two numbers from the list add up to k. For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17 This is the code I came up with : alist=[1,3,5,6,9] check=False k=int(input("Enter a number : ")) for i in range(5): for j in range(5): if((alist[i]+alist[j])==k): print(alist[i],"+",alist[j],"=",k) check=True if check!=True: print("Numbers dont add up") else : print("Therefore numbers add up") The code is running fine, but if I enter the value of k as 10, this is what I get as output : Enter a number : 10 1+9=10 5+5=10 9+1=10 Notice that 5 is repeated twice, which should not happen. A number should be used only once. I could add this condition while alist[i]!=alist[j] But is there a better way to write this code?