Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Diagrams.pptx
Binary file not shown.
Empty file added __init__.py
Empty file.
11 changes: 11 additions & 0 deletions bank.py
Original file line number Diff line number Diff line change
@@ -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
24 changes: 24 additions & 0 deletions client.py
Original file line number Diff line number Diff line change
@@ -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}")
29 changes: 29 additions & 0 deletions hackerrank.py
Original file line number Diff line number Diff line change
@@ -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))
47 changes: 47 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -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