Add 2026.04.08 function stack example and homework
All checks were successful
Deploy to birb co. production / deploy (push) Successful in 25s

This commit is contained in:
2026-04-09 09:51:40 -07:00
parent a732f31afd
commit 82ff1c82b0
2 changed files with 26 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
# Simple function stack example: Fibonacci sequence
# fibonacci(0) -> 0
# fibonacci(1) -> 1
# fibonacci(2) -> 1 (0 + 1)
# fibonacci(3) -> 2 (1 + 1)
# fibonacci(4) -> 3 (1 + 2)
# fibonacci(5) -> 5 (2 + 3)
# fibonacci(6) -> 8 (3 + 5)
def fibonacci(n: int):
pass

View File

@@ -0,0 +1,14 @@
# Make a calculator using Reverse Polish Notation. Use recursion.
# The Reverse Polish syntax completely removes the need for parentheses.
#
# Syntax examples:
# "3 + 2" -> ["3", "2", "+"]
# "3 * 4 + 2" -> ["3", "4", "*", "2", "+"]
# "3 * (4 + 2)" -> ["3", "4", "2", "+", "*"]
#
# Example for how to evaluate ["3", "4", "2", "+", "*"]:
# Start with "4 2 +" -> "6"
# Then "3 6 *" -> "18"
# Start with the "innermost" expression and work backwards (this is the recursion part)
#
# For help, email me@bchen.dev