Fibbonacci Sequence Hacks
def fib(num): # define function parameter = num
if num == 0 or num == 1: # if num is equal to 1 or 0, then just return them
return num
return fib(num - 1) + fib(num - 2) # else add the numbers 1 and 2 before the original one
for i in range(20): #loop 20 times
print(fib(i))
function fib(num){
if(num === 0 || num === 1){
return num
}
return fib(num - 1) + fib(num - 2)
}
for(i=0; i<20; i++){
console.log(fib(i))
}