A function is a reusable routine that does the same thing for a set of variable inputs:
as an example, if you were building a simple calculator, you would need functions for add, subrtract ,
multiply and divide among others.
the add function might look like this:
as an example, if you were building a simple calculator, you would need functions for add, subrtract ,
multiply and divide among others.
the add function might look like this:
>>> def add(a, b): ... return a + b ... >>> add(4, 5) 9 >>> add(2, 3) 5 >>> z = 2 >>> y = 9 >>> add(z, y) 11 >>>hope this is helpful