Ok guys I have this following Python script
myDict = {
"a":1,
"b":2,
"c":3
}
def get_ky(val):
for key, value in myDict.items():
if val == value:
return key
else:
return "no match"
myList = [1,2,3]
for i in myList:
print(get_ky(i))
and got this result
a
no match
no match
I want to know why it printed correct result at first iteration and "no match" at the consecutive iteration. please help me to understand this. Also this my first question, if I got something wrong please don't kill me.