diff --git a/Diagrams.pptx b/Diagrams.pptx new file mode 100644 index 0000000..430bf92 Binary files /dev/null and b/Diagrams.pptx differ diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/bank.py b/bank.py new file mode 100644 index 0000000..8a7f3e5 --- /dev/null +++ b/bank.py @@ -0,0 +1,11 @@ +lass Bank: + __clients = [] + def __init__(self,name): + self.name = name + def add_client(self,client): + self.__clients.append(client) + def authentication(self,name,account_number): + self.name = name + self.account_number = account_number + def getclient(self): + self.__clients diff --git a/client.py b/client.py new file mode 100644 index 0000000..505c043 --- /dev/null +++ b/client.py @@ -0,0 +1,24 @@ +import random +random_list=list(set(random.randint(10000,99999) for i in range(9999))) +class Client: + i = 0 + def __init__(self, name, total_amount): + self.name = name + self.total_amount = total_amount + self.account_number = random_list[Client.i] + self.account={'n':self.name,'ta':self.total_amount,"an":self.account_number} + Client.i += 1 + def withdraw(self,amount): + if self.total_amount >= amount: + self.total_amount -= amount + print(f"The sum of {amount} has been withdraw from your account balance.\ + Your current account balance is: {self.total_amount}") + else: + print("\n Insufficient balance ") + def deposit(self,amount): + self.total_amount = self.total_amount + amount + print(f"The sum of {amount} has been added to your account balance.\ + Your current account balance is: {self.total_amount}") + def balance(self,balance): + self.total_amount = balance + print(f"Your current account balance is: {self.total_amount}") diff --git a/hackerrank.py b/hackerrank.py new file mode 100644 index 0000000..4fe7c07 --- /dev/null +++ b/hackerrank.py @@ -0,0 +1,29 @@ +### sWAP cASE +s = "Hayat" +def swap_case(s): + return s.swapcase() +print(swap_case(s)) +### String Split and Join +words = "Is it work?" +def split_and_join(words): + x=words.split(" ") + x='-'.join(x) + return x +print(split_and_join(words)) +### Mutations +word = "Hello" +def mutation(word): + a = list(word) + a[1] = "รถ" + word = "".join(a) + return word +print(mutation(word)) +### Text Wrap +x = "I dontknowthatis it work" +max_width = 4 +def wrap(x, max_width): + s="" + for i in range(0,len(x),max_width): + s=s+x[i:i+max_width]+"\n" + return s +print(wrap(x, max_width)) diff --git a/main.py b/main.py new file mode 100644 index 0000000..9f00a69 --- /dev/null +++ b/main.py @@ -0,0 +1,47 @@ +from client import Client +from bank import Bank + +class Main(Bank): + bank = Bank(input("Please chosee a name of Bank: ")) + print(f"Welcome to {bank.name} Bank!\nChoose an option:") + while True: + menu = input("1. Open new bank account\n2. Open existing account\n3. Exit\nPlease code a number!: ") + if menu == "1": + print("To create an account, please fill in the information below.") + name_c = input("Name: ") + deposit_amount = int(input("Deposit amount: ")) + client = Client(name_c, deposit_amount) + bank.add_client(client.account) + print(f"Account created successfully! Your account number is: {client.account['an']}") + elif menu == "2": + while True: + print("To access your account, please enter your credentials below.") + name = input("Name: ") + account_number = int(input("Account Number: ")) + if name != name and account_number != account_number: + print("Authentication failed!\nReason: account not found.") + else: + name == name and account_number == account_number + print(input(f"Authentication successful!\nWelcome {name}\nChoose an option:\n1. Withdraw\n2. Deposit\n3. Balance\n4. Exit\nPlease code a number!: ")) + while True: + if input == "1": + withdraw = input("Withdraw amount:") + print(f"The sum of {withdraw} has been withdraw from your account balance.\ + Your current account balance is: {total_amont}") + + elif input == "2": + deposit = input("Deposit amount: ") + print(f"The sum of {deposit} has been added to your account balance.\ + Your current account balance is: {total_amount}") + + elif input == "3": + print(f"Your current account balance is: {total_amount}") + + elif input == "4": + print("Exit...") + + else: + print("Enter a correct value from given type help for commands") + else: + menu == "3" + break