Need more help with lists? Click here
What’s a Predict & Run task?
In these tasks you will be given one or more examples of code.
- Look at each example , study it carefully.
- Write a prediction of what it will do when it runs. Your prediction should be added to the code as comments.
- Run the code, compare what happens to your prediction.
- Add comments to note down and differences between your prediction and what actually happened.
Help! My code doesn’t work
Make sure that you check for the following things:
- Square brackets for items in the list
- Commas between each item in the list.
- String items are in quotation marks
- Range – the end value is NOT included in the output.
- Search – not initialising counter OUTSIDE the loop.
- Search – not incrementing counter INSIDE the loop.