Chapter 3 cards Flashcards
What is an algorithm?
A procedure for solving a problem in terms of:
- the actions to execute
- the order in which these actions execute
What is program control?
It specifies the order in which statements (actions) execute in a program.
Python does this with Python’s control statements
A(n) ______________ is a procedure for solving a problem. It specifies the ________ to execute and the _______ in which they execute
Algorithm, actions, order
What is Pseudocode?
An informal language that helps develop algorithms without having to worry about the strict details of Python synthax. Similar to everyday English. Helps you ‘think out’ a program before attempting to write it in a programming language
- Text describes what the program should do
- Convert text to Python with Python equivalent
T/F
Pseudocode is a simple programming language
False
Pseudocode is not a programming language. It’s an artificial and informal language that helps you develop algorithms
Define
Sequential execution
Where statements in a program execute in the order in which they’re written
Define
Transfer of control
A Python statement that enables you to specify that the next statement to execute may be other than the next one in sequence
Explain
How is transfer of control achieved?
With Python control statements
What are the 3 forms of control that all programs be written with?
- Sequential execution
- Selection statement
- Iteration statement (repetition)
Python statements execute ‘in sequence’ unless directed otherwise
Define
Flowchart
A ‘graphical’ representation of an algorithm or a part of one
Explain
How to draw a flowchart
Draw flowchart using rectangles, diamonds, rounded rectangles and small circles that you connect by arrows called flowlines
Why is a flowchart useful?
Helps develop and represent algorithms. They show how forms of control operate.
What do we use to indicate an action in a flowchart?
We use rectangle (or action) symbol
What shows the order in which actions are executed in a flowchart?
Flowlines
What is seen at the beginning of a complete algorithm?
A rounded rectangle containing the word Begin