What does zero mean in fib.get(4,0)? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What does zero mean in fib.get(4,0)?

1st Apr 2016, 6:18 PM
Евгений В
Евгений В - avatar
4 Answers
+ 3
In this example fib.get(4,0) the key 4 is present so it will pass the corresponding value 3 from the dictionary and now fib.get(7,5) the key 7 is not present so it will pass the second argument 5 so answer is 3+5=8
2nd Jul 2016, 8:28 PM
Sean T
Sean T - avatar
0
If there wasn't a key 4, assign value 0
6th Apr 2016, 9:19 PM
Johannes
Johannes - avatar
0
That helped a lot. thanks!
22nd Jun 2016, 7:37 PM
Matt
Matt - avatar
0
thanks a ton Sean T for explaining
16th May 2018, 8:07 AM
Driptarup Chatterjee
Driptarup Chatterjee - avatar