Add a new project (Bank Interest Calculator[1 python script, 1 README file]) and modified the project list by adding the new project's name and my GitHub

This commit is contained in:
C Tu 2024-05-26 18:09:51 +06:30
parent c4f08d05b5
commit fb29336703
3 changed files with 213 additions and 137 deletions

View File

@ -0,0 +1,13 @@
# Bank Interest Calculator
Simple Text-based interest calculator
### What can I do with it?:
- Calculate the interest amount
- Calculate the total amount including the interest
#### for the specified amount of years.
### How can I run it?
#### You can run it via:
- terminal or command prompt
- any IDE that supports Python

View File

@ -0,0 +1,62 @@
running = True
def program(choice):
years = int(input('How many years are you going to save? >> '))
amount = int(input('How much are you saving yearly? >> '))
r = input('What is the interest rate per year? (eg: 10, 0.1) >> ')
try:
rate = int(r)
except ValueError:
rate = float(r)
new_amount = 0
balance = 0
total = 0
interest = 0
n = 0
if choice.lower() == 'i':
for i in range(0, int(years)):
n += 1
if type(rate) is float:
interest += amount * rate
elif type(rate) is int:
interest += amount * (rate / 100)
print(f"In year {n}, the interest earned will be ${interest}")
total += interest
print(f'By the end of year {n}, the total interest earned will be ${total}.')
elif choice.lower() == 't':
for i in range(0, int(years)):
n += 1
if type(rate) is float:
if balance == 0:
interest = amount * rate
balance = amount + interest
elif balance > 0:
old_balance = balance
interest = (old_balance + amount) * rate
balance = old_balance + amount + interest
elif type(rate) is int:
if balance == 0:
interest = amount * (rate / 100)
balance = amount + interest
elif balance > 0:
old_balance = balance
interest = (old_balance + amount) * (rate / 100)
balance = old_balance + amount + interest
print(f"In year {n}, your total balance will be ${round(balance, 2)}")
print(f'By the end of year {n}, your total balance will be {round(balance, 2)}.')
while running:
print(
"How would you like to be calculated?\n'I' for total interest amount\n'T' for total balance including interest "
"amount\n'E' to exit program")
user_choice = input("Method >> ")
if user_choice.lower() == 'e':
running = False
else:
program(user_choice)

View File

@ -22,7 +22,7 @@ This repo is a compilation of some *awesome* Python scripts that automate some b
So far, the following projects have been integrated to this repo: So far, the following projects have been integrated to this repo:
| Project Name | Contributors | | Project Name | Contributors |
|--|--| |-------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|
| [2048](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/2048) | [Krunal](https://github.com/gitkp11) | | [2048](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/2048) | [Krunal](https://github.com/gitkp11) |
| [AI chatbot](Artificial-intelligence_bot) | [umar abdullahi](https://github.com/umarbrowser) | | [AI chatbot](Artificial-intelligence_bot) | [umar abdullahi](https://github.com/umarbrowser) |
| [AI for guess the number](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/AI_for_Guess_the_number) | [Omar Sameh](https://github.com/ShadowHunter15) | | [AI for guess the number](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/AI_for_Guess_the_number) | [Omar Sameh](https://github.com/ShadowHunter15) |
@ -31,6 +31,7 @@ So far, the following projects have been integrated to this repo:
| [Attachment Unique Mail](Attachment_Unique_Mail) | [Arnav Dandekar](https://github.com/4rnv) | | [Attachment Unique Mail](Attachment_Unique_Mail) | [Arnav Dandekar](https://github.com/4rnv) |
| [Automated calendar](automated_calendar) | [J.A. Hernández](https://github.com/jesusalberto18) | | [Automated calendar](automated_calendar) | [J.A. Hernández](https://github.com/jesusalberto18) |
| [Automated emails](automated_email) | [Suvigya](https://github.com/SuvigyaJain1) | | [Automated emails](automated_email) | [Suvigya](https://github.com/SuvigyaJain1) |
| [Bank Interest Calculator](Bank_Interest_Calculator) | [C Tu](https://github.com/ninja-noodle) |
| [Battery_notification](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Battery_notification/) | [Krishna Sharma](https://github.com/krishnasharma1386) | | [Battery_notification](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Battery_notification/) | [Krishna Sharma](https://github.com/krishnasharma1386) |
| [Better_CSV_Storage](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Better_CSV_Storage) | [Bhargav Kuvadiya](https://github.com/techdobz) | | [Better_CSV_Storage](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Better_CSV_Storage) | [Bhargav Kuvadiya](https://github.com/techdobz) |
| [Bitcoin price GUI](Bitcoin-Price-GUI) | [Amirul Abu](https://github.com/amirulabu) | | [Bitcoin price GUI](Bitcoin-Price-GUI) | [Amirul Abu](https://github.com/amirulabu) |