Skip to content

Khaomi/my-first-repo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Simple Bank Account Class

This is a basic Python project that demonstrates object-oriented programming (OOP) by implementing a BankAccount class. The class allows for creating accounts, depositing money, withdrawing money, and checking the account balance.


Features

The BankAccount class supports the following operations:

  • Create Account: Initialize a new account with an owner's name and an optional starting balance (defaults to 0).
  • Deposit: Add a positive amount to the account balance.
  • Withdraw: Subtract an amount from the balance. This action is only successful if the amount is positive and does not exceed the current balance.
  • Check Balance: Print the account owner and current balance using a human-readable string representation.

Files

  • bank.py: Contains the BankAccount class definition, including its attributes (owner, balance) and methods (deposit, withdraw, __str__).
  • main.py: A simple script that demonstrates how to import, create, and use an instance of the BankAccount class.

Requirements

  • Python 3.x

How to Use

To run the demonstration script, execute main.py from your terminal:

python main.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages