# Recursion and Fibonacci # Example: # Here is the stars function we went over earlier. # Try running the stars function on your own and see what happens! # Also feel free to base your other recursive functions off of stars(). def stars(x): if x == 1: return "*" else: return "*"+stars(x-1) # Exercise 1: # We are going to create a recursive function to calculate the factorial of a number # To understand what a factorial is lets calculate 5 factorial or 5!. # 5! = 5*4*3*2*1 # For this exercise we will provide the function setup and a template for your base conditional and recursive conditional def factorial(num): #Fill in the "if" of the base conditional here if : #Fill in the rest of the base conditional here. Make sure to indent! else: #Put your recursive conditional here. Make sure to indent! # Excercise 2: Final Exercise! # Now we are going to make a function that will calculate a specific number of the fibonacci sequence. # To help see if you are correct the first 15 numbers of the fibonacci sequence are [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987] # If you have questions don't be afraid to ask! This is a very difficult exercise! def fibonacci(num) # Base conditional goes here it will have an OR statement # Recursive conditional goes here