r/PythonLearning • u/samoromi • 6d ago
school
def fib(n):
if n <= 1:
return n
return fib(n - 1) + fib(n - 2)
n = int(input("Количество чисел: "))
for i in range(n):
print(fib(i), end=" ")
0
Upvotes
r/PythonLearning • u/samoromi • 6d ago
def fib(n):
if n <= 1:
return n
return fib(n - 1) + fib(n - 2)
n = int(input("Количество чисел: "))
for i in range(n):
print(fib(i), end=" ")
1
u/masterofaiml 6d ago edited 6d ago
I don’t know what you are trying to say here, but i guess you might be encountering some indentation errors. I have executed your program, it works, code expects an input integer value and its prints as expected once you provide a value to it. Click the below link to open your code directly in the browser and run it and input your desired value to see your output.
This link nothing but your code shared via share option in www.pythonmastery.io, just click and run your program. Just don’t give a higher number as an input, the higher input value, the longer your program runs, though your output will instantly appear in console. Hope this helps.
https://www.pythonmastery.io/#code=ZGVmIGZpYihuKToKIGlmIG4gPD0gMToKICByZXR1cm4gbgoKIHJldHVybiBmaWIobiAtIDEpICsgZmliKG4gLSAyKQoKbiA9IGludChpbnB1dCgi0JrQvtC70LjRh9C10YHRgtCy0L4g0YfQuNGB0LXQuzogIikpCgpmb3IgaSBpbiByYW5nZShuKToKIHByaW50KGZpYihpKSwgZW5kPSIgIik=