Why is the output of the 42? Only when j1 output is 5, only j3 when output is 9, how did this cycle?
CodePudding user response:
Loop, the first layer is in accordance with the len (J) the length of the cycle, such as J contains 1 to 6, length is eight, then I is 0,1,2,3,4,5 The number of the second loop, num finally add 1 is len (j [I] [x]), I=0 loop out when is len (j1 [x]) the value of the So, This function is calculated, all the dict J, length and finally + J x yuan length Len (j1 [x])=4 Len (j2 [x])=4 Len (j3 [x])=8 Len (j4 [x])=5 Len (j5 [x])=7 Len (j6 [x])=8
If only the j1, len (J) + len (j1 [x])=1 + 4=5 If only the j3, len (J) + len (j1 [x])=1 + 8=9 J have 1 to 6, len (J) is 6, len (J) + len (j1). + len (j6)=6 + 4 + 4 + 5 + 7 + 8 + 8=42