0
How is the output accumulated?
Could you please explain me this code? Why the output is not simply func(5)+func(4)=3+2? Thank you very much! https://code.sololearn.com/cREVZs0T5ux5/?ref=app
7 Antworten
+ 4
Arr remains alive after the first call and we have:
Arr = [0,2,4]=>len = 3 #first call
Arr = [0,2,4,0,2]=>len = 5 second call
So first + second = 3+5=8
+ 3
Ok lets do job sharing:
You hack the code into SL coding section and I will tekk u.
In general a linked code has better chances for supoort.
+ 3
The idea is still the same as I mentioned:
[0,2,4] #len = 3 =>line1
[0,2,4,0,2] #len = 5 =>line2
[0,2,4,0,2,0,2,4] #len=8# + [0,2,4,0,2,0,2,4,0,2] #len=10
=> len=8+10=18 =>line3.
And for line4 it's same.
+ 1
Oma Falk noted with thanks! I’m sorry for that, the code is added.
+ 1
Qasem oh i see! I changed ‘return len(arr)’ to ‘return arr’ and got your general idea. Thanks a lot.
However, if it returns len(arr), func(range(5))+func(range(4)) gives 18? But if it returns arr, there are 20 values in the array.
+ 1
Qasem ohh okok, thanks for your patience to explain me the details!
0
Nemui great!