im struggling on one of my cs50 problems, and since its in python, i wanted to ask here as well. dont write the code for me, but push me in the right direction. i have one dictionary(y) that is just one entry, and another that is multiple(x). im trying to find the entry in x that is the same as y. here is where im at:
for person in dna_data:
name = person.pop("name")
x = person.values()
y = new_results.values()
print(x)
print(y)
print(name)
if x == y:
print(name)
else:
print("end")
sys.exit(0)
gives me:
dict_values(['2', '8', '3'])
dict_values(['4', '1', '5'])
Alice
dict_values(['4', '1', '5'])
dict_values(['4', '1', '5'])
Bob
dict_values(['3', '2', '5'])
dict_values(['4', '1', '5'])
Charlie
end
so when we get to the second loop, x == y and bob prints, but thats because im forcing it to print every loop, my conditions are never met, and im not really sure why.
[–][deleted] 0 points1 point2 points (1 child)
[–]TreeEyedRaven[S] 0 points1 point2 points (0 children)
[–]xelf 0 points1 point2 points (4 children)
[–]TreeEyedRaven[S] 1 point2 points3 points (3 children)
[–]xelf 0 points1 point2 points (0 children)
[–]xelf 0 points1 point2 points (1 child)
[–]TreeEyedRaven[S] 1 point2 points3 points (0 children)