mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-27 18:43:52 +08:00
Fixed xrange compatibility for Python 3
This commit is contained in:
@ -1,5 +1,10 @@
|
||||
from __future__ import print_function
|
||||
|
||||
try:
|
||||
xrange #Python 2
|
||||
except NameError:
|
||||
xrange = range #Python 3
|
||||
|
||||
def fibonacci(n):
|
||||
if n == 1 or type(n) is not int:
|
||||
return 0
|
||||
|
Reference in New Issue
Block a user