Join 36000+ teachers and students using TTIO.
In Python, functions begin with the key word "def" e.g.
def chatbot():
The code inside a function must always be indented inside it.
Indentation, in Python, means something. It indicates belonging to!
Using functions helps to write more organised code and it is far easier to manage, test and re-use parts in other programs. Have a look at the trinket below and see if you can
a) count how many functions have been used
b) write your own function
www.teachyourselfpython.com