class Person:
def __init__(self, name, lastname):
self.name = name
self.lastname = lastname
class Client(Person):
def __init__(self, name, lastname, nr_account, balance=0):
super().__init__(name, lastname)
self.nr_account = nr_account
self.balance = balance
def __str__(self):
return f"Client Nº {self.name} {self.lastname}. Balance :${self.balance} in {self.nr_account} account."
def deposit(self, money):
self.balance += money
print("Deposit accepted")
def withdraw(self, money):
if self.balance >= money:
self.balance -= money
print("Withdraw realized")
else:
print("Insufficient funds")
def create_client():
name_cl = input("Please enter your name: ")
lastname_cl = input("Please enter your lastname: ")
nr_account_cl = input("Please enter your account number: ")
client = Client(name_cl, lastname_cl, nr_account_cl)
return client
def init():
my_client = create_client()
print(my_client)
option = 0
while option != 'F':
print("Choose: Deposit (D), Withdraw (W) or Finish (F)")
option = input()
if option == "D":
to_deposit = int(input("Money to deposit: "))
my_client.deposit(to_deposit)
elif option == "W":
to_withdraw = int(input("Money to withdraw: "))
my_client.withdraw(to_withdraw)
print(my_client)
print("Thank you for using Python Bank")
init()
bank-account_python's Introduction
bank-account_python's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.