Created
July 2, 2024 16:38
-
-
Save gmotzespina/666242b3bfe447c6a8757745767a2571 to your computer and use it in GitHub Desktop.
Fibonacci example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def fibonacci(num): | |
| if num<= 1: | |
| return num | |
| else: | |
| return fibonacci(num-1) + fibonacci(num-2) | |
| print(fibonacci(6)) # Output: 8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment