code test

In the Exercise 45 in Learn python the hard way book we have to make a game of our own choice, I choose a project of ATM machine. In this project I am going to implement a program which works like ATM machine but won’t give any money! or something, but just prompts the customers or users the operations that they made using my program. Here is abstract which will describe better. ATM abstract

ww

This is actually in half way through completion. Actually we can complete this project in different ways using possibilities in python language. I think one way is with if elif else and the other way is with OOP concepts using classes and function. And here I can say that implementing with If else means the beginners way and using oop concepts will be the pro way. So here I will try to post both ways. Soon I ll complete this project and post full code here.

check my starting code:
print "WELCOME TO PYTHON ATM"
print "INSERT YOUR CARD"
choice = raw_input("> ")
while (choice != "insert"):
print "REMOVE AND INSERT YOUR CARD PROPERLY!"
choice = raw_input("> ")
print "ENTER YOUR NAME"
name = raw_input("> ")
print "CREATE A PIN"
pin = int(raw_input("> "))
print "present amount in your account is 5000/- INR\n"
cash = 50000
print "ACCOUNT IS CREATED!"
# print "name %s, pin %d, cash in account %d" % (name, pin, cash)
print "remove and insert your card again for transactions!"
rm = raw_input("> ")
while (rm != "remove"):
print "REMOVE YOUR CARD FIRST PLEASE"
rm = raw_input("> ")
print "card is removed"
print "insert card again"
choice = raw_input("> ")
while (choice != "insert"):
print "INSERT YOUR CARD PROPERLY!"
choice = raw_input("> ")
print "choose and option\n"
print ">>'b' for BALANCE ENQUERY"
print ">>'p' for PIN CHANGE"
print ">>'w' for WITH DRAWAl"
print ">>'d' for DEPOSIT"
option = raw_input("> ")
print "Enter pin number"
upin = int(raw_input("> "))
if (upin == pin):
print "PIN CORRECT"
else:
print "PIN IS INVALID!"

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s