forked from CoreyMSchafer/code_snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
206aec5
commit 1514054
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import datetime | ||
import calendar | ||
|
||
balance = 10000 | ||
interest_rate = 13 * .01 | ||
monthly_payment = 1000 | ||
|
||
today = datetime.date.today() | ||
days_in_current_month = calendar.monthrange(today.year, today.month)[1] | ||
days_till_end_month = days_in_current_month - today.day | ||
|
||
start_date = today + datetime.timedelta(days=days_till_end_month + 1) | ||
end_date = start_date | ||
|
||
while balance > 0: | ||
interest_charge = (interest_rate / 12) * balance | ||
balance += interest_charge | ||
balance -= monthly_payment | ||
|
||
balance = round(balance, 2) | ||
if balance < 0: | ||
balance = 0 | ||
|
||
print(end_date, balance) | ||
|
||
days_in_current_month = calendar.monthrange(end_date.year, end_date.month)[1] | ||
end_date = end_date + datetime.timedelta(days=days_in_current_month) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import datetime | ||
import math | ||
|
||
goal_subs = 150000 | ||
current_subs = 85000 | ||
subs_to_go = goal_subs - current_subs | ||
|
||
avg_subs_day = 200 | ||
days_to_go = math.ceil(subs_to_go / avg_subs_day) | ||
|
||
today = datetime.date.today() | ||
|
||
print(today + datetime.timedelta(days=days_to_go)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import datetime | ||
|
||
current_weight = 220 | ||
goal_weight = 180 | ||
avg_lbs_week = 2 | ||
|
||
start_date = datetime.date.today() | ||
end_date = start_date | ||
|
||
while current_weight > goal_weight: | ||
end_date += datetime.timedelta(days=7) | ||
current_weight -= avg_lbs_week | ||
|
||
print(end_date) | ||
print(f'Reached goal in {(end_date - start_date).days // 7} weeks') |