Hi muddpigeon,
So I have some questions about your code:
(1) I don't know what 'withdraw with' and withdraw without' mean ...
(2) It looks like you want the code to execute sequentially from top to bottom. Is that correct? If so, I have a suggestion about organization. If not, what is your overall plan ('pseudo-code') for your atm machine?
(3) How does the machine know what the correct pin # is? Will any pin between 1000 and 9000 do the trick?
Also, when you post code, use the [ code=Python ] and [ /code ] tags (eliminate the spaces for proper functioning) so that your code will have the proper indentation levels.
Jeff
jrcagle
Practically a Master Poster
608 posts since Jul 2006
Reputation Points: 92
Solved Threads: 156
OK, the pseudo-code is actually something you create before you start, and it guides your thinking. Here's the coding process I follow for non-class-based programs:
(1) Decide on the functionality of the program. This is called the Use Case or User Story.
(2) Divide up the functionality into small pieces. These will be your functions.
(3) Write a function at a time, testing as you go.
Now, I would recommend for maximum learning purposes that you pause here and do steps 1-2, if you've not already done so.
OK, that's done.
Now, it looks like your overall program organization wants to be something like this:
print greeting
print directions
get pin
if pin is valid:
while eternity lasts:
get user choice
if choice == withdraw_with:
get amount
spit out cash
print statement
elif choice == withdraw_without:
get amount
spit out cash
elif choice == x
quit program
else:
print error
Is that your basic plan?
Now, each pseudo-code statement, such as "print greeting" or "get pin", becomes a separate function.These functions do not get executed in order from top to bottom. Instead, they get defined at the beginning of your program, and then the main code -- above -- will call them as needed.
Does that help you get started?
Jeff
jrcagle
Practically a Master Poster
608 posts since Jul 2006
Reputation Points: 92
Solved Threads: 156
Post over in the Java forum, I guess.
But I kinda liked my pseudo-code in post #3, so maybe that can get you somewhere.
Jeff
jrcagle
Practically a Master Poster
608 posts since Jul 2006
Reputation Points: 92
Solved Threads: 156