The idea of a function in simplest of words can be defined as a machine where an input goes in, some process is done inside the machine and an output comes out.
To understand this, we can take a real life example of a vending machine. The user puts in the money (or the card with credit in it), punches a specific button for what he wishes to take out and then that the selected item is dropped into the output slot.
Here the input will be the money (or card) along with the selection of the item, the output will be the product and the price of that product will be the function rule.