1. Make your own command
A function is a named recipe you can use again and again. Define it with def, give it parameters in brackets, and send the answer back with return:
def with_gst(price): return price * 1.18
Now with_gst(100) gives 118.0. The code inside does not run until you call the function.
return is not the same as print: print only shows the answer on screen, while return hands it back so other code can use it, e.g. bill = with_gst(250).
def square(n):
return n * n
print(square(4))
big = square(12) + 1
print(big)
Challenge: GST calculator
Write a function with_gst(price) that returns the price plus 18% GST, rounded to 2 decimals. So with_gst(100) returns 118.0 and with_gst(250) returns 295.0. Use return, not print.