File tree Expand file tree Collapse file tree 3 files changed +55
-0
lines changed Expand file tree Collapse file tree 3 files changed +55
-0
lines changed Original file line number Diff line number Diff line change 1+ import datetime
2+ import calendar
3+
4+ balance = 10000
5+ interest_rate = 13 * .01
6+ monthly_payment = 1000
7+
8+ today = datetime .date .today ()
9+ days_in_current_month = calendar .monthrange (today .year , today .month )[1 ]
10+ days_till_end_month = days_in_current_month - today .day
11+
12+ start_date = today + datetime .timedelta (days = days_till_end_month + 1 )
13+ end_date = start_date
14+
15+ while balance > 0 :
16+ interest_charge = (interest_rate / 12 ) * balance
17+ balance += interest_charge
18+ balance -= monthly_payment
19+
20+ balance = round (balance , 2 )
21+ if balance < 0 :
22+ balance = 0
23+
24+ print (end_date , balance )
25+
26+ days_in_current_month = calendar .monthrange (end_date .year , end_date .month )[1 ]
27+ end_date = end_date + datetime .timedelta (days = days_in_current_month )
Original file line number Diff line number Diff line change 1+ import datetime
2+ import math
3+
4+ goal_subs = 150000
5+ current_subs = 85000
6+ subs_to_go = goal_subs - current_subs
7+
8+ avg_subs_day = 200
9+ days_to_go = math .ceil (subs_to_go / avg_subs_day )
10+
11+ today = datetime .date .today ()
12+
13+ print (today + datetime .timedelta (days = days_to_go ))
Original file line number Diff line number Diff line change 1+ import datetime
2+
3+ current_weight = 220
4+ goal_weight = 180
5+ avg_lbs_week = 2
6+
7+ start_date = datetime .date .today ()
8+ end_date = start_date
9+
10+ while current_weight > goal_weight :
11+ end_date += datetime .timedelta (days = 7 )
12+ current_weight -= avg_lbs_week
13+
14+ print (end_date )
15+ print (f'Reached goal in { (end_date - start_date ).days // 7 } weeks' )
You can’t perform that action at this time.
0 commit comments