Skip to ContentGo to accessibility pageKeyboard shortcuts menu
OpenStax Logo

Highlights from this chapter include:

  • Describe the concept of recursion.
  • Demonstrate how recursion uses simpler solutions to build a bigger solution.
  • Identify a recursive case and a base case in a recursive algorithm.
  • Demonstrate how to compute a recursive solution for the factorial function.
  • Demonstrate the use of recursion to solve a string problem.
  • Demonstrate the use of recursion to solve a list problem.
  • Use the built-in count() list function.
  • Define a recursive function to generate Fibonacci numbers.
  • Use recursion to efficiently search a list.
  • Demonstrate a solution to the Three Towers problem.

At this point, you should be able to solve problems using recursion.

Function Description

count(element)

Returns the number of times the element exists on the list on which the count() function is called.

Table 12.1 Chapter 12 reference.
Citation/Attribution

This book may not be used in the training of large language models or otherwise be ingested into large language models or generative AI offerings without OpenStax's permission.

Want to cite, share, or modify this book? This book uses the Creative Commons Attribution License and you must attribute OpenStax.

Attribution information
  • If you are redistributing all or part of this book in a print format, then you must include on every physical page the following attribution:
    Access for free at https://openstax.org/books/introduction-python-programming/pages/1-introduction
  • If you are redistributing all or part of this book in a digital format, then you must include on every digital page view the following attribution:
    Access for free at https://openstax.org/books/introduction-python-programming/pages/1-introduction
Citation information

© Feb 26, 2024 OpenStax. Textbook content produced by OpenStax is licensed under a Creative Commons Attribution License . The OpenStax name, OpenStax logo, OpenStax book covers, OpenStax CNX name, and OpenStax CNX logo are not subject to the Creative Commons license and may not be reproduced without the prior and express written consent of Rice University.