ECON 3209 · Week 2, Lecture 2 · Kerala Agricultural University
Autumn 2026
By the end of this lecture, you will be able to:
def and call them with appropriate arguments*args and **kwargs in flexible function designIf you compute loan interest for 50 borrowers, a function is safer than rewriting the same formula 50 times.
def starts a function definitionreturn sends a value back to the callerif block each time*args*args collects extra positional arguments into a tuple**kwargs**kwargs collects extra keyword arguments into a dictionarycompute_interest() instead of do_it()Write a function called net_income that takes revenue and cost as inputs and returns profit.
Then call the function for: - Revenue = 125000, Cost = 86000 - Revenue = 98000, Cost = 102000
Finally, print whether each farm made a profit or a loss.
defreturn sends results back for later use*args and **kwargs allow flexible inputs when neededECON 3209 — Kerala Agricultural University