# Https://app.dataquest.io/m/1010/conditional-statements-practice-problems/16/finding-the-pair

https://app.dataquest.io/m/1010/conditional-statements-practice-problems/16/finding-the-pair

Hi,

In this question, why is the answer not include other results like 39 and 61?

1 Like

As we are looping through the end it will always give last combination. If you print `value1` and `value2` you can see several possibility

``````for x in values:
for y in values:
if x + y == 100 and x != y:
value1 = x
value2 = y
print(value1, value2)
``````

Output

``````85 15
85 15
39 61
61 39
15 85
15 85
``````
3 Likes

Thanks for the answer Dishin.

1 Like

Glad it helps! Please consider to like post or mark it as a solution if you found helpful. GUIDELINE #2: Accept and mark answer as `Solution`

If you find a reply that answers your question satisfactorily, please mark it as `Solution` . Doing so will help -

• Others learners, who are searching for the same problem, find the solution faster
• With the Learning Assistant program - by marking the answer as solution, you can directly help the person who helped you.
1 Like

after sorting it out, I’ve made a solution that lists all the pairs:

``````empty_list = []
for i in values:
for c in values:
if i + c == 100 and i != c:
empty_list.append([i, c])
``````

Hi! For me it happened the same, i recalled only one pair of numbers because i wrote the print code outside the loop. If you print inside the loop it shows you all the combinations. Could you explain why? thank you!
Also, in the beginning i started with value1= and value2= instead of value1=None and value2=None, is this correct? the answer seems to be ok but i need to know if my solution was ok regarding to the syntax. Thanks thanks thanks!

Hi! For me it happened the same, i recalled only one pair of numbers because i wrote the print code outside the loop. If you print inside the loop it shows you all the combinations.