- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasicUserRegistrationSystem.py
More file actions
Latest commit
43 lines (36 loc) · 1.55 KB
/
Copy pathBasicUserRegistrationSystem.py
File metadata and controls
43 lines (36 loc) · 1.55 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
importrandomasr
classBankHolder:
def__init__(self, name, age, bank, accountnumber):
try:
self.name=name
iflen(self.name) <=2:
raiseValueError("Your name shouldn't be two characters")
self.age=age
ifself.age<18:
raiseValueError("You are a minor")
else:
pass
upper_bank=bank.upper()
self.bank=upper_bank
iflen(self.bank) ==0orlen(self.bank) ==0:
raiseValueError("You didn't select a bank")
elifupper_bank=="FNB"orupper_bank=="NEDBANK"orupper_bank=="PRIVATE BANK":
pass
else:
raiseValueError("Invalid bank selected")
self.accountnumber=accountnumber
exceptValueErrorasve:
print("Value Error:", ve)
defdetails(self):
returnf"Welcome, {self.name}! You have successfully created an account with {self.bank}.Your account number is {self.accountnumber}. Your current balance is R0."
try:
user_name=input("Enter your name: ")
user_age=int(input("Enter age: "))
user_bank=input("What bank do you wish to use (FNB/NEDBANK/PRIVATE BANK): ")
user_aN=r.randint(1000000, 1999999)
user_information=BankHolder(user_name, user_age, user_bank, user_aN)
print(user_information.details())
exceptValueErrorasve:
print("Error:", ve)
exceptExceptionase:
print("An unexpected error occurred:", e)