+ 1
Range() & len () question
Why the output is 0? a = range(5) b = [x for x in a if x >= 5] print(len(b))
3 Antworten
+ 13
Because the last number 'a' contains is 4 and the comprehension requires it to be over 5.
+ 2
Valen.H. ~ if only print (a), the output is range (0, 5). does this take into account as only two arguments (0 and 5)? or as a range of 5, (0,1,2,3,4)!?