Ok, so my program's input is the number of days someone worked. They earn .02 a day. Each day they work after the first, their pay doubles...(.04, .08, .16....) my code below displays the days worked and the money earned each day. I think i did it the hard way (not sure what the easy way is) and since i have reassigned dollars, I don't think the counter is working porperly. Can somone point out my error(s) in my code?
def main():
#get the ending limit
days = int(input('How manys days were worked?'))
end = days + 1
total = 0
MAX = end
dollars = 2
#print table headings
print()
print('Days\tDollars')
print('------------------------------')
#print the days and the amount of money that was earned that day
for days in range(2):
dollars = days * 2
print(days, '\t', '$',format(dollars / 100,',.2f'))
for days in range(2, end):
dollars = dollars * 2
print(days, '\t', '$',format(dollars / 100,',.2f'))
#count the days and add the values until the loop stops at the MAX
for counter in range(MAX):
total = dollars + total
print('the amount of money you earned is: $',format(total / 100,',.2f'))
main()