A calculator's square-root key is a black box. Press 49 and you get 7; press 2 and you get 1.414…, and you have no idea how the chip works it out. You do not need to. What matters is the behaviour: each input produces one output, and the same input always produces the same output. Thinking of a function this way is the input-output view.
In symbols, f(x) means 'the output of machine f when x goes in'. For the machine 'double and add 1', written f(x)=2x+1, the statement f(3)=7 reads 'input 3, output 7'. The brackets mean 'put this in', not multiply. You can ask two kinds of question: forward (what is f(5)? It is 11) and backward (which input gives 15? Undo the steps: 15−1=14, then 14÷2=7).
Not every box qualifies. A box that sometimes answers 3 and sometimes −3 for the input 9 is unpredictable, so it is not a function machine. A random-number button fails for the same reason: pressing it twice gives different results. A function machine may give the same output for different inputs, as 32 and (−3)2 both give 9, but never different outputs for the same input.
Think of it like this. In the input-output view, a function is like a toaster with a dial: set it to 3 and you always get the same shade of toast, without knowing anything about the wiring inside. If the same setting sometimes burned the bread and sometimes left it pale, it would not be a function.
Core idea. The input-output view treats a function as a machine: a value goes in and one determined value comes out, ignoring the inner workings.