-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass.py
More file actions
69 lines (53 loc) · 1.72 KB
/
Copy pathclass.py
File metadata and controls
69 lines (53 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
class atm:
def __init__(self):
self.balance=0
self.pin=""
self.menu()
def menu(self):
print('''
select any number from 1 to 4
press 1 to create pin
press 2 to for deposite
press 3 to withdraw moneyy
press 4 to check balance
press other key to exit
''')
user_inut=input("entr any number (1 to 4)")
if user_inut=="1":
self.createpin()
elif user_inut=="2":
self.deposite()
elif user_inut=="3":
self.withdraw()
elif user_inut=="4":
self.checkbalance()
else:
exit()
def createpin(self):
user_pin=input("Enter Pin Number ")
self.pin=user_pin
print("Pin Successfully Created!!")
self.menu()
def deposite(self):
#for authentication of the useer
user_pin=input("Enter Pin Number ")
if self.pin==user_pin:
amount=int(input("Enter Your Amount"))
self.balance = amount+ self.balance
print("Successfully Credited")
self.menu()
else:
print("Unauthorized Access")
def withdraw(self):
user_pin=input("Enter Pin Number ")
if self.pin==user_pin:
amount =int(input("Enter withdrawel amount"))
self.balance= self.balance-amount
print("Withdraw Successfully")
self.menu()
def checkbalance(self):
user_pin=input("Enter Pin Number ")
if self.pin==user_pin:
print("balance:",self.balance)
self.menu()
sbi=atm()