0

hey there,
i have a piece of coursework to be handed in tomorow and i am struggling to get this new bit of code that has been issued right. i have to write the pseudocode for an atm machine and one of the procedures is to validate a pin number. i already hav the following code written out but i now have to add in that the number must be between 1000 and 9000, if any one can give me an idead of where to go next this would be a big help. many thanx muddpigeon.

PROCEDURE CheckPIN
CONSTANTS
MAXPINS IS 3
VARIABLES
PINCounter IS NUMBER
BEGIN
read data from card
set PINCounter to zero
LOOP UNTIL PINCounter is equal to MAXPINS
input PIN from customer keypad
IF entered PIN matches card PIN
THEN EXITLOOP
ENDIF
add 1 to PINCounter
ENDLOOP
IF PINCounter is equal to MAXPINS
THEN confiscate customer's card
ELSE CALL PROCEDURE Services
ENDIF
END CheckPIN:cheesy:

2
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by muddpigeon
0

Here is way to do it:

def check_pin(pin):
    """check if pin number pin is between 1000 and 9000"""
    if 1000 <= pin <= 9000:
        return True
    return False

pin = int(raw_input("Enter pin number (between 1000 and 9000): "))
print check_pin(pin)
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.