First Commit
This commit is contained in:
commit
c19ecb2ae9
61
main.py
Normal file
61
main.py
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
MONTHS_PER_YEAR = 12
|
||||||
|
WEEKS_PER_YEAR = 52
|
||||||
|
# Grab income
|
||||||
|
HOURS_WORKED=40
|
||||||
|
WAGES = 14.5
|
||||||
|
TAX_BUFFER = 0.8
|
||||||
|
|
||||||
|
#<<<<<<<<<<<<<<<<<<<<<<< Add all your bills here >>>>>>>>>>>>>>>>>>>>>>>>
|
||||||
|
bills = {
|
||||||
|
"water": 50,
|
||||||
|
"gas": 50,
|
||||||
|
"electric": 130,
|
||||||
|
"insurance": 100,
|
||||||
|
"car payment": 200,
|
||||||
|
"rent": 875,
|
||||||
|
"internet": 80
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def income():
|
||||||
|
weeklyIncome = HOURS_WORKED * WAGES * TAX_BUFFER
|
||||||
|
yearlyIncome = weeklyIncome *WEEKS_PER_YEAR # Weeks per year
|
||||||
|
monthlyIncome = yearlyIncome/MONTHS_PER_YEAR
|
||||||
|
|
||||||
|
income = {
|
||||||
|
"weekly": weeklyIncome,
|
||||||
|
"monthly": monthlyIncome,
|
||||||
|
"yearly": yearlyIncome
|
||||||
|
}
|
||||||
|
return income
|
||||||
|
|
||||||
|
def toUSD (x):
|
||||||
|
return "${:,.2f}".format(x)
|
||||||
|
|
||||||
|
income = income()
|
||||||
|
#add some space
|
||||||
|
print()
|
||||||
|
print("You worked", HOURS_WORKED, "hours.")
|
||||||
|
print("Your wages are", toUSD(WAGES), "per hour.")
|
||||||
|
print()
|
||||||
|
print("Your income:")
|
||||||
|
for x, y in income.items():
|
||||||
|
print("\t" + x, toUSD(y))
|
||||||
|
# Grab all bills
|
||||||
|
print()
|
||||||
|
print("Your bills:")
|
||||||
|
for x, y in bills.items():
|
||||||
|
print("\t" + x, toUSD(y))
|
||||||
|
|
||||||
|
billTotal = 0
|
||||||
|
for x in bills.values():
|
||||||
|
billTotal = billTotal+x
|
||||||
|
print("Total:")
|
||||||
|
print("\t" + toUSD(billTotal))
|
||||||
|
|
||||||
|
print()
|
||||||
|
print("Remaining Monthly:")
|
||||||
|
print("\t" + toUSD(income["monthly"]-billTotal))
|
||||||
|
|
||||||
|
print("Remaining Yearly:")
|
||||||
|
print("\t" + toUSD(income["yearly"]-billTotal*MONTHS_PER_YEAR))
|
Loading…
x
Reference in New Issue
Block a user