Completed code and checked solution, but it hangs checking the solution forever. When running the code from the editor it outputs the correct answer. Here's the code I'm attempting to have checked.
def fib(n):
"""This is documentation string for function. It'll be available by fib.doc()
Return a list containing the Fibonacci series up to n."""
result = []
a = 1
b = 1
while a < n:
result.append(a)
tmp_var = b
b += a
a = tmp_var
return result
if name == 'main':
print(fib(10))
"C:\Users\Ben D-K\PycharmProjects\Introduction to Python.idea\VirtualEnvironment\Scripts\python.exe" "C:/Program Files/JetBrains/PyCharm Community Edition 2022.3.2/plugins/python-ce/helpers/pydev/pydevd.py" --multiprocess --qt-support=auto --client 127.0.0.1 --port 55677 --file "C:\Users\Ben D-K\PycharmProjects\Introduction to Python\Functions\Return value\return_keyword.py"
Connected to pydev debugger (build 223.8617.48)
[1, 1, 2, 3, 5, 8]
Completed code and checked solution, but it hangs checking the solution forever. When running the code from the editor it outputs the correct answer. Here's the code I'm attempting to have checked.
def fib(n): """This is documentation string for function. It'll be available by fib.doc() Return a list containing the Fibonacci series up to n.""" result = [] a = 1 b = 1 while a < n: result.append(a) tmp_var = b b += a a = tmp_var return result
if name == 'main': print(fib(10)) "C:\Users\Ben D-K\PycharmProjects\Introduction to Python.idea\VirtualEnvironment\Scripts\python.exe" "C:/Program Files/JetBrains/PyCharm Community Edition 2022.3.2/plugins/python-ce/helpers/pydev/pydevd.py" --multiprocess --qt-support=auto --client 127.0.0.1 --port 55677 --file "C:\Users\Ben D-K\PycharmProjects\Introduction to Python\Functions\Return value\return_keyword.py" Connected to pydev debugger (build 223.8617.48) [1, 1, 2, 3, 5, 8]
Process finished with exit code 0