I have a nested list here that shows the day in the first index position and the number of items in the second. I need to find whether the number of items on the previous day is less than the number of items on the current day and find the difference( e.g number of items on day 2 is less than day 1) and if in the 4 days all items are more than the previous days. But I am not sure how to iterate through the current figures. I expect to see the first statement get printed if items in current day is less than the previous day and the second if all days are more (Day: 2 Difference: 2, Day: 4 Difference: 1)
list1=[[1,3],[2,1],[3,4],[4,3]]
def calculator():
figure= list1[1][1]
for day,prev_figure in list1:
if figure<=prev_figure:
difference= prev_figure-figure
print(f"DAY:{day}, DIFFERENCE{difference}")
for day,prev_figure in list1:
if figure>=prev_figure:
print("EVERY DAY ITEMS ARE MORE THAN THE PREVIOUS DAY")