ok you will probably be sick of my posts but i have tryed and got this far, i ripped the program to pieces and started again. basically its a atm program that i have to do for college. if anyone can see why its not workin properly it would be a great help.

import pickle
f= open ("pin.pck", "w")
pickle.dump(1234, f)
pickle.dump([1,2,3,4], f)
f.close()
#Pin Validation
def pin():
f=open("pin.pck", "r")
x=pickle.load(f)
print
print " ***Welcome to the bellco banking system***"
print "============================================="
print "Please insert your card"
print ""
print "Card Accepted"
print ""
pin = input ("Please insert your pin number to the keypad: ")
print "=============================================="

#Checks if pin is within range of 1000 to 9999
while True:
if pin>=1000
print "Pin accepted"
if pin =<9999:
print "Pin accepted"
print
if pin== x:
print "Valid Pin"
print
if pin != x:
print "Invalid Pin"
print
pin()
break
else:
print "Invalid Pin"
pin()
break

#Create Menu
def createmenu():
print " ***Welcome to Bank ATM*** "
print "=================================="
print " Please select one of the below "
print " 1 Withdrawal only"
print " 2 Withdrawal With Statement"
print " 3 Statement only"
print " 4 Quit"
print "=================================="

#Statement Procedure
def statement():
print "Your balance is $" #balance details
print
print "Thank you for using this Bank ATM"
print "=================================="

#Withdrawal Procedure
def withdrawal():
print "================================"
print " Please select one of the below "
print " 1 $50"
print " 2 $100"
print " 3 $150"
print " 4 $200"
print "================================="

amount= raw_input ("Please make your selection:")
print "===================================="
while True:
if amount == "1":
print "You have chosen to withdraw $50"
print
print "Please take your cash"
print "================================="
break
#Insert coding to remove cash from balance
elif amount == "2":
print "You have chosen to withdraw $100"
print
print "Please take your cash"
print "==================================="
break
#Insert coding to remove cash from balance
elif amount == "3":
print "You have chosen to withdraw $150"
print
print "Please take your cash"
print "================================="
break
#Insert coding to remove cash from balance
elif amount == "4":
print "You have chosen to withdraw $200"
print
print "Please take your cash"
print "================================="
break
else:
print "Invalid Selection - Re-enter"
withdrawal()
break
#Menu Options
def selectoption():
keypadinput = raw_input ("Enter your selection: ")
while True:
if keypadinput == "1":
print
print "You have chosen to make a withdrawal"
withdrawal()
break
elif keypadinput == "2":
print
print "You have chosen to make a withdrawal withdrawal with a statement"
withdrawal()
statement()
break
elif keypadinput == "3":
print
print "You have chosen to print a statement"
statement()
break
elif keypadinput == "4":
print
print "Thank you for using this Bank ATM"
break
else:
print "Invalid Selection"
selectoption()
break
#Initiate Program
pin()
createmenu()
selectoption()

Recommended Answers

All 5 Replies

Please put your code in [ code ] and [ /code ] tag

Note:
Leave no space between square brackets('').

kath.

ok you will probably be sick of my posts but i have tryed and got this far, i ripped the program to pieces and started again. basically its a atm program that i have to do for college. if anyone can see why its not workin properly it would be a great help.

import pickle
f= open ("pin.pck", "w")
pickle.dump(1234, f)
pickle.dump([1,2,3,4], f)
f.close()
#Pin Validation
def pin():
f=open("pin.pck", "r")
x=pickle.load(f)
print
print " ***Welcome to the bellco banking system***"
print "============================================="
print "Please insert your card"
print ""
print "Card Accepted"
print ""
pin = input ("Please insert your pin number to the keypad: ")
print "=============================================="
 
#Checks if pin is within range of 1000 to 9999 
while True:
if pin>=1000
print "Pin accepted"
if pin =<9999:
print "Pin accepted"
print
if pin== x:
print "Valid Pin"
print
if pin != x:
print "Invalid Pin"
print
pin()
break
else:
print "Invalid Pin"
pin()
break 
 
#Create Menu
def createmenu():
print " ***Welcome to Bank ATM*** "
print "=================================="
print " Please select one of the below "
print " 1 Withdrawal only"
print " 2 Withdrawal With Statement"
print " 3 Statement only"
print " 4 Quit"
print "=================================="
 
#Statement Procedure
def statement():
print "Your balance is $" #balance details
print
print "Thank you for using this Bank ATM"
print "=================================="
 
#Withdrawal Procedure
def withdrawal():
print "================================"
print " Please select one of the below "
print " 1 $50"
print " 2 $100"
print " 3 $150"
print " 4 $200"
print "================================="
 
amount= raw_input ("Please make your selection:")
print "===================================="
while True:
if amount == "1":
print "You have chosen to withdraw $50"
print
print "Please take your cash"
print "================================="
break
#Insert coding to remove cash from balance
elif amount == "2":
print "You have chosen to withdraw $100"
print
print "Please take your cash"
print "==================================="
break
#Insert coding to remove cash from balance
elif amount == "3":
print "You have chosen to withdraw $150"
print
print "Please take your cash"
print "================================="
break
#Insert coding to remove cash from balance
elif amount == "4":
print "You have chosen to withdraw $200"
print
print "Please take your cash"
print "================================="
break
else:
print "Invalid Selection - Re-enter"
withdrawal()
break
#Menu Options
def selectoption():
keypadinput = raw_input ("Enter your selection: ")
while True:
if keypadinput == "1":
print
print "You have chosen to make a withdrawal"
withdrawal()
break
elif keypadinput == "2":
print
print "You have chosen to make a withdrawal withdrawal with a statement"
withdrawal()
statement()
break
elif keypadinput == "3":
print
print "You have chosen to print a statement"
statement()
break
elif keypadinput == "4":
print
print "Thank you for using this Bank ATM"
break
else:
print "Invalid Selection"
selectoption()
break
#Initiate Program
pin()
createmenu()
selectoption()

it is hard get replies if you send your code like this because your code is all mixed up and NOT properly indented. Hence it is hard to make out what code block comes within a function or while loop.
As you know python depends on indentation, to tell which to execute when it encounters conditional statements or loop control statements or function. So it is very important for you to make code properly indented and post. Even you cannot execute this program if you copy and paste and then execute. do you understand?

for eg:

if 1:
     print "hi, how are you"
else:
     print "bye."

can you see the difference now?


kath.

import pickle
f= open ("pin.pck", "w")
pickle.dump(1234, f)
pickle.dump([1,2,3,4], f)
f.close()
#Pin Validation
def pin():
f=open("pin.pck", "r")
x=pickle.load(f)
print
print " ***Welcome to the bellco banking system***"
print "============================================="
print "Please insert your card"
print ""
print "Card Accepted"
print ""
pin = input ("Please insert your pin number to the keypad: ")
print "=============================================="
 
#Checks if pin is within range of 1000 to 9999 
while True:[indent]if pin>=1000[indent]print "Pin accepted"[/indent]
[indent][/indent]if pin =<9999:[indent]print "Pin accepted"[/indent]
[indent][/indent]print
if pin== x:[indent]print "Valid Pin"[/indent]
[indent][/indent]print
if pin != x:[indent]print "Invalid Pin"[/indent]
[indent][/indent]print
[/indent]pin()
break[indent]else:[/indent]
[indent]print "Invalid Pin"[/indent]
[indent][/indent]pin()
break 
 
#Create Menu
def createmenu():
print " ***Welcome to Bank ATM*** "
print "=================================="
print " Please select one of the below "
print " 1 Withdrawal only"
print " 2 Withdrawal With Statement"
print " 3 Statement only"
print " 4 Quit"
print "=================================="
 
#Statement Procedure
def statement():
print "Your balance is $" #balance details
print
print "Thank you for using this Bank ATM"
print "=================================="
 
#Withdrawal Procedure
def withdrawal():
print "================================"
print " Please select one of the below "
print " 1 $50"
print " 2 $100"
print " 3 $150"
print " 4 $200"
print "================================="
 
amount= raw_input ("Please make your selection:")
print "===================================="
while True:[indent]if amount == "1":[indent]print "You have chosen to withdraw $50"[/indent]
[indent][/indent][/indent]print
print "Please take your cash"
print "================================="
break
#Insert coding to remove cash from balance
[INDENT]elif amount == "2":
[INDENT]print "You have chosen to withdraw $100"
[/INDENT]print
[/INDENT]print "Please take your cash"
print "==================================="
break
#Insert coding to remove cash from balance
[INDENT]elif amount == "3":
[INDENT]print "You have chosen to withdraw $150"
[/INDENT][/INDENT]print
print "Please take your cash"
print "================================="
break
#Insert coding to remove cash from balance
[INDENT]elif amount == "4":
[INDENT]print "You have chosen to withdraw $200"
[/INDENT][/INDENT]print
print "Please take your cash"
print "================================="
break
[INDENT]else:
[INDENT]print "Invalid Selection - Re-enter"
[/INDENT][/INDENT]withdrawal()
break
#Menu Options
def selectoption():
keypadinput = raw_input ("Enter your selection: ")
while True:
[INDENT]if keypadinput == "1":
print
[INDENT]print "You have chosen to make a withdrawal"
[/INDENT][/INDENT]withdrawal()
break
[INDENT]elif keypadinput == "2":
[/INDENT]print
[INDENT][INDENT]print "You have chosen to make a withdrawal withdrawal with a statement"
[/INDENT][/INDENT]withdrawal()
statement()
break
[INDENT]elif keypadinput == "3":
[/INDENT]print
[INDENT]print "You have chosen to print a statement"
[/INDENT]statement()
break
[INDENT]elif keypadinput == "4":
[/INDENT]print
[INDENT][INDENT]print "Thank you for using this Bank ATM"
[/INDENT][/INDENT]break
[INDENT]else:
[INDENT]print "Invalid Selection"
[/INDENT][/INDENT]selectoption()
break
#Initiate Program
pin()
createmenu()
selectoption()

i dnt knwo if tht was what i was to do but i could get the tabulation right

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.