8000 restored fib function to original version that does not guard against… · syk-coder/rabbitmq-tutorials@d8ab36c · GitHub
[go: up one dir, main page]

Skip to content

Commit d8ab36c

Browse files
author
Ann Witbrock
committed
restored fib function to original version that does not guard against negative numbers
1 parent a3e8c85 commit d8ab36c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

python/rpc_server.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212

1313

1414
def fib(n):
15-
if n > 1:
16-
return fib(n-1) + fib(n-2)
15+
if n == 0:
16+
return 0
17+
elif n == 1:
18+
return 1
1719
else:
18-
return n
20+
return fib(n-1) + fib(n-2)
1921

2022
def on_request(ch, method, props, body):
2123
n = int(body)

0 commit comments

Comments
 (0)
0