Preview lessons, content and tests

Computer Science & Programming solved. All in one platform.

1. To trial the platform and take tests, please take a few seconds to SIGN UP and SET UP FREE.

2. Searching for something specific? See our text overview of all tests. Scroll right for levels, and lists.

3. Student and Teacher User Guides |  Schemes of Work |   Real Teacher use Videos |


Join 30000+ teachers and students using TTIO.

Functions

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

Try it yourself

a) count how many functions have been used

b) write your own function

www.teachyourselfpython.com