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
21 changes: 21 additions & 0 deletions BMI Calculator/bmicalc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import pyinputplus as pyip

#Input user variables
weight = pyip.inputInt('How much do you weigh in Lbs? ')
height = pyip.inputInt('How tall are you in inches? ')

#Calculate BMI
bmi = (703 * weight) / (height) ** 2
bmi = round(bmi, 1)

#Logic for under/overweight per BMI scale
if bmi < 18.5:
bmi_category = 'underweight'
elif bmi >= 18.5 and bmi <= 24.9:
bmi_category = 'normal weight'
elif bmi >= 25 and bmi <= 29.9:
bmi_category = 'overweight'
elif bmi >= 30:
bmi_category = 'obese'

print(f'your BMI is {bmi}, you are {bmi_category}.')
39 changes: 39 additions & 0 deletions BMI Calculator/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Simple BMI Calculator (Python)

A straightforward command-line tool to calculate **Body Mass Index (BMI)** and determine your weight category based on standard classifications.

## What it does

- Asks for your weight (in pounds)
- Asks for your height (in inches)
- Calculates BMI using the imperial formula
- Displays your BMI rounded to 1 decimal place + weight category

## BMI Categories (imperial units)

| BMI Range | Category |
|-----------------|-----------------|
| < 18.5 | Underweight |
| 18.5 – 24.9 | Normal weight |
| 25.0 – 29.9 | Overweight |
| 30.0 and above | Obese |

## Requirements

- Python 3.x
- [pyinputplus](https://pypi.org/project/PyInputPlus/) library

```bash
pip install pyinputplus

##Usage

python bmicalc.py
# or
python3 bmicalc.py

## Example Run

How much do you weigh in Lbs? 165
How tall are you in inches? 68
your BMI is 25.1, you are overweight.
18 changes: 18 additions & 0 deletions Calculate Compound Interest/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Compound Interest Calculator

A simple Python script to calculate future value of savings with regular monthly contributions and annual compound interest.

## Features
- Interactive input using pyinputplus (validates numbers automatically)
- Annual compounding (interest applied once per year)
- Monthly contributions converted to annual lump sum added at end of each year
- Clean currency-formatted output

## Example run
How many years will you be saving? Enter amount: 10
How much money is currently in your account? Enter amount: 100000
How much money do you plan on investing monthly? Enter amount: 100
What do you estimate will be the yearly interest of this investment?
Enter rate as percent (%): 5

This is how much money you would have in your account after 10 years: $177,982.93
34 changes: 16 additions & 18 deletions Calculate Compound Interest/calculateCompoundInterest.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
print('How many years will you be saving?')
years = int(input('Enter years: '))
import pyinputplus as pyip

print('How much money is currently in your account?')
principal = float(input('Enter current amount in account: '))
#User input variables for calculating compound interest
time = pyip.inputInt('How many years will you be saving? Enter amount: ')
principal = pyip.inputFloat('How much money is currently in your account? Enter amount: ')
monthly_invest = pyip.inputFloat('How much money do you plan on investing monthly? Enter amount: ')
interest_percent = pyip.inputFloat('''What do you estimate will be the yearly interest of this investment?\n
Enter rate as percent (%): ''')

print ('How much money do you plan on investin monthly?')
monthly_invest = float(input('Enter amount: '))
#Interest conversion
rate = interest_percent/100

print ('What do you estimate will be the yearly interest of this investment?')
interest = float(input ('Enter interest in decimal numbers (10% = 0.1): '))
print(' ' )
#Calculate final amount after investing and accruing interest:
balance = principal

monthly_invest = monthly_invest * 12
final_amount = 0
for year in range(time):
balance = balance * (1 + rate)
balance += monthly_invest * 12

for i in range(0, years):
if final_amount == 0:
final_amount = principal

final_amount = (final_amount + monthly_invest) * (1 + interest)

print("This is how much money you would have in your account after {} years: ".format (years) + str(final_amount))
#Print final result
print(f"This is how much money you would have in your account after {time} years: ${balance:,.2f}")
Loading