Why the answer is 8 🤔 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why the answer is 8 🤔

fib={1:1,2:1,3:2,4:3} print(fib.get(4,0)+fib.get(7,5))

8th Sep 2022, 8:53 AM
Christian M. De Los Santos
Christian M. De Los Santos - avatar
2 Answers
8th Sep 2022, 8:58 AM
Prashanth Kumar
Prashanth Kumar - avatar
+ 3
try separating the print into print(fib.get(4,0)) print(fib.get(7,5)) since 4 is in fib it will print 3 instead of 0 since 7 is not in fib, it will print 5. 3 + 5 = 8
8th Sep 2022, 11:24 AM
Bob_Li
Bob_Li - avatar