Chapter 12
Designing Algorithms

An algorithm is a set of steps that accomplishes a task, such as the steps involved in synthesizing caffeine. Each function in a program, as well as the program itself, is an algorithm that is written in a programming language like Python. Writing a program directly in Python, without careful planning, can waste hours, days, or even weeks of effort. Instead, programmers often write algorithms in a combination of English and mathematics and then translate it into Python.

In this chapter, you’ll learn an algorithm-writing technique called top-down design. You start by describing your solution in English and then mark the phrases that correspond directly to Python statements. Those that don’t correspond are then rewritten in more detail in English, until everything in your description can be written in Python.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.184.102