Create a Word document, give it the filename 17_08_28_name (year month day so that when sorted into numerical order the files are in date order: neat huh?) where name is your own name. At the end of the lesson save a copy of your Word document into Student common \ ICT \ Collaboration\ _Mr_Mitchell \ Year 11 Computer Science \ Classwork. All of your work is to be completed on this Word document: add appropriate screenshots, diagrams, drawings and images where necessary.
First, this is a programming task. Use the Python Guide to help you to solve this problem. Create a menu (use the guide to help) that offers four choices.
2. Find the average of three real numbers.
4. Input a whole number and then print out the times table (1 to 12) for that number.
Looking at the Python Guide we note that chapter 14 is all about making a menu of choices.
Simply using the code from the page and adding the four options from the question, we get this.
Try it for yourself. You should have something like this...
The next step is to add the code for each option.
Using exercise 10d from the Python Guide, this is the additional code that is required. This would work...
Take note of how the formula in mathematics has been changed for use in Python. Use simple test values, 50 Fahrenheit is 10 Celcius for example.
Find the average of three real numbers.
This is relatively easy, input 3 numbers, add them up and divide by 3. This can be done with three variables, one for each number or a loop. Guess whcih way the examiner prefers? The loop is more "elegant" but hey as long as it works...
This could be extended to ask for "how many numbers" and it would still find the average. How would this code have to be altered?
This is more difficult but you can make use of exercise 11c from the Python Guide, and turn the process into a loop. This would work...
Sorting the array is a little trickier. There is a technique called the "Bubble Sort" that compares two adjacent items and if the second is larger than the first swaps them round. If this is repeated often enough then the list will be sorted.
This is some testing ...
You can see that the second list has been sorted into alphabetical order.
This is a good explanation of "Bubble Sort". I have added some examples of sorting to the Python Guide (Section 17).
Input a whole number and then print out the times table (1 to 12) for that number.
This is exercise 9c from the Python Guide. Really easy.
You can now add some quality to your code so that it will
- Keep repeating until option 5 is selected.
- Accept incorrect input without crashing.
When the program runs the user can select one of the four choices and then the selected choice will be executed.
Make an outline plan as we have done before and complete as much as possible in the two lessons. Document everything that you have done including screenshots of code, output and testing. Here is a testing table in suffient detail for a GCSE NEA project.
Making the program more robust.
"In computer science, robustness is the ability of a computer system to cope with errors during execution and cope with erroneous input." As such, Python offers a number of techniques that can be employed to improve the quality of the program that you make and to access the higher level marks.
In the example shown below I have used while and try / except as two methods of improving reobustness.
In effect this makes the request for input again and again until the user enters a suitable value. You have to set the sel;ection variable to have a wrong value at the start to force the while loop to begin.
Try / except
This captures any error that would result in a "ValueError" exception and enables the programmer to ensure that the program does not crash but asks the user for the corret input.
IF all of this is complete then make sure that all of the answers to the work from the previous weeks and the two examination papers that were set at the end of last year are complete. (First and second papers.)
These are questions that relate to the AQA guides above.
These are some revision topics and example questions that will aid revision for the year 10 examination on 23rd June 2017. Just because it is in this list does not mean that its in the exam and if it is not in the list it does not mean that the topic is not inthe exam.
Here are the answers to the mock examination that you took in the summer.
For many students the objective here is to understand how to answer questions, to see where silly mistakes were made that cost easy marks and to appreciate how the examiner can aske questions relating to the theory that you already know.
Here is the information regarding your coursework as well as some worked examples to show you how coursework should be written up.
The coursework will be done twice, once with the example task for practice and then the real NEA task. You will only have 20 hours in which to complete the real task; there cannot be any extra time given.