#๐Ÿ”’ Why in fibanacci lecture , the lecturer wrote 1 and 2 on f(3) and f(2)

35 messages ยท Page 1 of 1 (latest)

gusty widget
#

Same as title

hidden lakeBOT
#

@gusty widget

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

rustic python
#

Because fib(3) is 2 and fib(2) is 1.

gusty widget
#

f(n) = f(n-1) + f(n-2)

#

that's why?

rustic python
#

f(2) = f(2-1) + f(2-2)
f(2) = f(1) + f(0)
f(2) = 1 + 0
f(2) = 1

gusty widget
#

and then what about f(3)?

#

why its two tho

lofty depot
#

substitute 3 in

gusty widget
#

f(3) = f(3-1) + f(3-2)

#

f(3) = 1 + 1

#

f(3) = 2

#

oh yeh

#

fug

#

I got it

#

I forgot to subsitute it

rustic python
#

No, f(3-1) is f(2) that is 1

lofty depot
#

its f(2) + f(1)

gusty widget
#

f(3) = f(2) + f(1)

#

f(2) = 1
f(1) = 1

#

f(3) = 1+1

#

f(3) = 2

#

is it right?

rustic python
#

yes

gusty widget
#

yeh got I got it

#

thank you guys @lofty depot @rustic python

#

I apperciate the help

#

๐Ÿ™

whole bane
#

Looks like you're learning recursion and memoization?

gusty widget
whole bane
gusty widget
hidden lakeBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.