Starting Out with Python (3rd Edition)
Starting Out with Python (3rd Edition)
3rd Edition
ISBN: 9780133582734
Author: Tony Gaddis
Publisher: PEARSON
Question
Book Icon
Chapter 12.2, Problem 2CP
Program Plan Intro

Problem Solving:

In Python, a problem can be divided into smaller parts only if it has an identical structure to the whole problem. Then, it can be solved using recursion.

Working method of recursive function:

A recursive function has two approaches. They are as follows:

  • • If a problem can be solved currently without using recursion, then use function to solve it and returns.
  • • If a problem cannot be solved currently, then the function reduces the problem into smaller parts only if it has a similar structure to the whole program. And the function calls itself to solve the sub-parts.

Blurred answer
Students have asked these similar questions
What are the advantages that come with having referential transparency?
What are these definitions?
Explain the differences between the different types of semantics, when and how they should be used, and the pros and cons of each type.

Chapter 12 Solutions

Starting Out with Python (3rd Edition)

Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education