Fibonacci

VRU ⟢ Fibonacci
# Fibonacci
# fib1 = 1
# fib2 = 1
# fib3 = 1 + 1 = 2
# fib4 = 1 + 2 = 3
# fib5 = 2 + 3 = 5
# fib6 = 3 + 5 = 8
# fib7 = 5 + 8 = 13

def function(param):
      if param < 1:
         	return None
      if param < 3:
        	return 1

      elem1 = elem2 = 1
      sum = 0
      for i in range(3, param + 1):
        sum = elem1 + elem2
        elem1, elem2 = elem2, sum
      return sum                           # definitia functiei se termina aici

for param in range(1, 10): 	           # test
      print(param, "->", function(param))

# 1 -> 1
# 2 -> 1
# 3 -> 2
# 4 -> 3
# 5 -> 5
# 6 -> 8
# 7 -> 13
# 8 -> 21
# 9 -> 34