+ 2
didnt understand this code
fib = {1: 1, 2: 1, 3: 2, 4: 3} print(fib.get(4, 0) + fib.get(7, 5)) ans is 8 but how ??
2 Respostas
+ 8
the answer is like this:
fib.get(4,0) returns 3, as this is the value for key 4
fib.get(7,5) returns 5, as there is no key with this value. the second parameter is a value that will be used, in case key is not found
finally add 3 + 5 so you get 8