Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -35,14 +35,14 @@ def fibonacci(n: str) -> str:
|
|
| 35 |
# Initialize the Fibonacci sequence
|
| 36 |
fib_sequence = [0, 1]
|
| 37 |
|
| 38 |
-
if n >
|
| 39 |
-
n=
|
| 40 |
# Generate Fibonacci numbers up to n
|
| 41 |
for i in range(2, n):
|
| 42 |
fib_sequence.append(fib_sequence[-1] + fib_sequence[-2])
|
| 43 |
|
| 44 |
# Return the sequence as a string
|
| 45 |
-
return f"The Fibonacci series up to the {n}th number (but not higher than
|
| 46 |
|
| 47 |
except Exception as e:
|
| 48 |
return f"Sorry, there was an error generating the Fibonacci series: {e}"
|
|
|
|
| 35 |
# Initialize the Fibonacci sequence
|
| 36 |
fib_sequence = [0, 1]
|
| 37 |
|
| 38 |
+
if n > 2000:
|
| 39 |
+
n=2000
|
| 40 |
# Generate Fibonacci numbers up to n
|
| 41 |
for i in range(2, n):
|
| 42 |
fib_sequence.append(fib_sequence[-1] + fib_sequence[-2])
|
| 43 |
|
| 44 |
# Return the sequence as a string
|
| 45 |
+
return f"The Fibonacci series up to the {n}th number (but not higher than 2000) is: {', '.join(map(str, fib_sequence))}"
|
| 46 |
|
| 47 |
except Exception as e:
|
| 48 |
return f"Sorry, there was an error generating the Fibonacci series: {e}"
|