You should have a growing knowledge of how to use different Python commands and how to create simple programs. That will only get you so far, however.
Now it's time to start thinking and acting like a programmer. There are three key concepts that will make writing a longer, more complex program much easier. The resources and tasks on this page should help you to do master these.
An algorithm is a plan or logical step-by-step process for solving a problem. When trying to create a program it is much easier to write an algorithm first before you try and write it in Python.
Algorithms are normally written either as a flowchart or in pseudocode:
A flowchart is a diagram that represents a set of instructions
Pseudocode is a simple way of describing a set of instructions that does not have to use specific syntax
When designing an algorithm there are two main areas to look at:
the big picture - What is the final goal?
the individual stages – What hurdles need to be overcome on the way to the goal?
Before an algorithm can be designed, it is important to check that the problem is completely understood. There are a number of basic things to know in order to really understand the problem:
What are the inputs into the problem?
What will be the outputs of the problem?
In what order do instructions need to be carried out?
What decisions need to be made in the problem?
Are any areas of the problem repeated?
Once these basic things are understood, it is time to design the algorithm!
Task: Use this BBC Bitesize guide to designing algorithms to learn how to write flowcharts and pseudocode. Complete the test at the end.
Then have a go at using the approach you prefer to write down three different Grok problems.
There are three basic building blocks (the proper name is constructs) that form the basis of just about every program. These are:
Sequence: The top to bottom order in which instructions occur and are processed in a program or subroutine.
Selection: Which path a program takes when it is running based on a condition (the results of an event).
Iteration (or loops): The repeated execution of a section of code when a program is running, either count-controlled or condition-controlled)
You need to know what these constructs are and create code routines and subroutines for each of them. They will all be needed for the assessment task!
Task: Use this great guide from BBC bitesize on the 3 basic coding constructs. Once you've understood it, complete the test at the end.
Next try and create a simple program that achieves what the pseudocode on each page says. Sorry - the videos don't work in NZ!
Code for Humans means code that is meant to be read by other humans (code comments, docstrings, good variable names etc) and code that is meant to be used by humans (error checking, good error messages, good instructions, crash proofing etc.)
This video series covers the important things you have to keep in mind when you write code for humans.
You'll also walk through a simple example of a problem, similar to your assessment problems. In that, you will learn to write highly readable and unbreakable code that neatly handles input errors.
Task: Watch the first intro video to set the scene. Then watch the second video, writing the "Can I Vote" program with the instructor. See if you can work out how and why it works.