Question: This assignment features a person with a less lucrative salary plan: he gets 1 cent on the 1 st day, 2 cents on the 2

This assignment features a person with a less lucrative salary plan: he gets 1 cent on the 1stday, 2 cents on the 2ndday, and for every day thereafter he gets the sum of the previous two days.So his salary progression is: .01, .02, .03, .05, .08, .13, ...

Here is my code:

#expect no parameter input

def main():

days=int(input("Hello! How many days did you work?:"))

lst=build_list(days)

print(lst)

day=int(input("Which day's salary you would like to see:"))

print_day(day,lst)

for sal in lst:

for s in sal:

print(s,end ='\t')

print()

def build_list(days):

lst= []

for d in range (days):

drow = []

if d== 0:

sal =.01

else:

sal=lst[d-1][1]

drow.append(d+1)

drow.append(sal)

lst.append(drow)

return lst

def print_day(day,lst):

print("The salary for Day "+str(day)+" is "+str(lst[day-1][1]))

print("WorkdaySalary")

main()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Law Questions!