A function generates a number (output) if we supply an input value. For example, if f(x) = x², then x is the input value, and f(x) or x² is the output value.
The set of all possible input values is the domain. In the case of f(x)=x², the domain are all real numbers, or dom(f(x))=ℝ.
Range is the set of all possible output values, and for f(x)=², it is limited to the non-negative real numbers, or [0,∞).
A real life situation could be the cost of gasoline, given by f(x)=price*x where price is the price per gallon/litre, and x is the number of units purchased.