def global_fib(n, filename):
load_fib, write_fib, fib, and return_fib. So the intended result will be given a number n, you will need to load the last calculated fib sequence, and add n additional Fibonacci terms to the filename, and return the last Fibonacci number written on the file.
import os # for file operations.
IMPORTANT: make sure every line in your fib_file has ONE empty space at the end.
Example:
>>> global_fib(filename)
>>> global_fib(3, filename) # 0th Fibonacci sequence is 0, adding three terms will be 0, 1, 1, 2
>>> with open(filename, 'r') as f:
data = f.read() # Note there is an empty space after 2
>>> print(data) # 0 1 1 2
# IMPORTANT: DO NOT CHANGE ANY CODE WITHIN THIS FUNCTION #
global gf
gf = load_fib(filename)
i = write_fib(filename)
while i < n:
fib(write_fib(filename))
i += 1
return return_fib()
##### Define fib function here ###
##### Define write_fib function here ###
##### Define load_fib function here ###
##### Define return_fib function here ###