Read, analyse and refine programs (Edexcel GCSE Computer Science): Flashcards
📚Flashcards
Practise the cards
13 cards from this deck
ShowHide
Practise the cards
13 cards from this deck
'Read' in code analysis
'Read' in code analysis
Examining code to understand what it does and how it works
'Analyse' in code analysis
'Analyse' in code analysis
Identifying problems, inefficiencies, or areas to improve
'Refine' in code analysis
'Refine' in code analysis
Making changes to improve the program
Requirement when refining code
Requirement when refining code
Must still meet all specified requirements
Why multiple if statements inefficient for ranges
Why multiple if statements inefficient for ranges
Check every condition even after finding correct range
Advantage of if...elif...else over multiple if
Advantage of if...elif...else over multiple if
Stops checking conditions once correct range is found
When to use if...elif...else
When to use if...elif...else
For mutually exclusive conditions
Better than many separate variables for similar data
Better than many separate variables for similar data
Lists and loops
Python function to add numbers in a list
Python function to add numbers in a list
sum()
Code pattern: repeated similar code solution
Code pattern: repeated similar code solution
Simplify using loops or functions
Code pattern: inefficient conditionals solution
Code pattern: inefficient conditionals solution
Use if...elif...else instead of multiple if statements
Code pattern: poor data storage solution
Code pattern: poor data storage solution
Use lists, dictionaries, or other data structures
What refined code must still produce
What refined code must still produce
Same correct output
