# If statement not capturing the conditional I'm seeking [closed]

I'm working on a hw assignment, and my if statement isn't working the way it's intended.

This is an ATM machine project. I've already gotten the program to read the csv file and stored it into a dictionary with the pin number as the key.

What I can't get it to do is find the pin number in my getUser() function. Below is the code and under that is the IDLE result. Please help!

d = {}
def startUp(fname):
try:
acct_file = open(fname,'r')
for line in acct_file:
(key,first,last,balance) = line.split(',')
d[int(key)] = [last,first,float(balance)]
print(d)
getUser()
except:
print('Cannot get to the file')

def getUser():
user_pin = int(input('What is your pin number? '))
if user_pin in d.keys():
return (user_pin,first,True)
else:
print('Incorrect Pin')
return (None,None,False)


IDLE result: What is your pin number? 9967 this returns nothing

• It returns nothing, but that pin number is in the file. – Dennis Kim Mar 5 '19 at 22:05
• Hi Dennis! Unfortunately, this site is mostly for theoretical computer science; practical programming issues, like this one, will get better answers on StackOverflow. – Draconis Mar 5 '19 at 22:17
• Oh got it. Thanks, @Draconis! – Dennis Kim Mar 5 '19 at 22:21