livepython.net
CHAPTER 03Programmer Mindset
3.5  PRACTICE

Programmer Mindset Practice and Recap

Chapter 3 Recap and Practice

You now think like a programmer: in clear steps. Here is the chapter in one table:

IdeaRemember
Programmer mindsetThink in steps; understanding beats memorising
Break it downSplit big problems until each step is easy
Be exactComputers do exactly what you write, never what you meant
AlgorithmA clear, complete list of steps, in order, that ends
The 4-step methodObserve, break it down, plan, code
FlowchartA plan as a drawing: oval, rectangle, parallelogram, diamond, arrows
DecisionA diamond with one yes-or-no question and two paths
DebuggingRead the error, find the line, change one thing, run again
Checkpoint printAn extra print() that shows how far your code got
When stuckExplain it, take a break, search the error, ask with details

Practice questions

Each question is a small plan to turn into code. Write the steps in words first, then the program.

  1. 30.Python Program to Print the Steps of an ATM WithdrawalEasySolve
  2. 31.Python Program to Print a Recipe From a FlowchartEasySolve
  3. 32.Fix a Python Program With Steps in the Wrong OrderEasySolve

Clear steps first, code second. That's the programmer mindset.