Average by key (join, reduceByKey and aggregateByKey)

I havebeen following the videos and got stuck at “Average by key (join, reduceByKey and aggregateByKey)” concept.
Can some one explain please explain more about the logic of “aggregateByKey()” and “combineByKey()” in the below code:

CombineByKey():

revenuePerDay = revenuePerDayPerOrderMap.combineByKey( \

lambda x: (x, 1), \

lambda acc, revenue: (acc[0] + revenue, acc[1] + 1), \

lambda total1, total2: (round(total1[0] + total2[0], 2), total1[1] + total2[1]) \

)

aggregateByKey():

revenuePerDay = revenuePerDayPerOrderMap.aggregateByKey( \

(0, 0), \

lambda acc, revenue: (acc[0] + revenue, acc[1] + 1), \

lambda total1, total2: (round(total1[0] + total2[0], 2), total1[1] + total2[1]) \

)

thanks in advance.

You will understand this in detail if you have clear understanding of how combiners work in MR. Please go through that first:)