7️⃣

18.7 Practice

Practice

Reminder: For all of the practice problems below, make sure to return the answers rather than print them.

Factorial

Create a recursive method that mirrors how a factorial would work in math.

Koch Curve

This is a fun problem that uses the turtle module. The goal of this problem is to create a Koch curve. More details can be found in the downloadable.

List Sum

Create a recursive sequence that finds the sum of a list that may contain another list within it.

Logarithm

Create a recursive method that mirrors how a logarithm works in math. You can have the base by default by ten. You do not have to deal with decimals, just worry about returning integers.
Note: logarithms return the power that you raise a base number to in order to get a number.
Ex: Logarithm of 9 to base 3 = 2; In this example, since 3 to the second power gives you 9, the logarithm of 9 to base 3 is equal to 2.

Previous Section

Next Section

Ch. 18 Quiz
 
⚖️
Copyright © 2021 Code 4 Tomorrow. All rights reserved. The code in this course is licensed under the MIT License. If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact classes@code4tomorrow.org for inquiries.