170 likes | 358 Views
Session 5. Teaching Computing to GCSE Level with Python Pseudocode & Flowcharts. In this session:. Theory (linked to programming so overlap!) Pseudocode & Flowcharts Types of errors Example examination question. Specification – Programming languages. AQA Data types
E N D
Session 5 Teaching Computing to GCSE Level with Python Pseudocode & Flowcharts
In this session: Theory (linked to programming so overlap!) • Pseudocode & Flowcharts • Types of errors • Example examination question
Specification – Programming languages AQA Data types Data structures (1 and 2 dimensional arrays) Flowcharts Structure diagrams Procedures Functions Parameters Syntax, run-time and logical errors OCR Pseudocode Flowcharts Selection and iteration Data types 1-dimensional arrays Generations of languages Assembly language/machine code Compilers and interpreters Syntax, run-time and logical errors This is a summary of headings – text available as handout
Task 1: debugging a program Handout: average function in Python Can you find the errors?
Program with errors There are 8 errors!
Pseudocode • Many exam questions involve working with pseudocode– for example, working through an algorithm written in pseudocode • Being able to translate from pseudocode to a real language and back is a key skill • AQA have guidelines for the specification of pseudocode • http://filestore.aqa.org.uk/subjects/AQA-GCSE-COMPSCI-W-TRB-PSEU.PDF
Task 2 Convert the average program to pseudocode Answer (following AQA handout): output “How many numbers do you want to average”) howManyNums UserInput runningTotal0 FOR count 1 to HowManyNums Output “Enter the next number” nextNumberUserInput runningTotalrunningTotal + nextNumber endFOR AveragerunningTotal/howManyNums output “The average of these” output HowManyNums output “is “ output Average
Flowcharts Symbols for • A process (e.g. calculation) • Input or output (e.g. user input) • Terminator (start/finish) • Decision (condition of if statement or loop)
Task 4 Convert average program to a flowchart
Task 4: Answer (one of many possible?!) Start Input howManyNums Set count,runningTotal to 0 Is count =howmanyNums YES NO Input nextNum Add nextNum to runningTotal Increment count Calculate average Finish
Summary Summary • Pseudocode and flowcharts enable us to represent/explain/design a program in a language-independent way • They allow students to focus on the logic and the program control • Students will need lots of practice with these – so start early!