+ 1

Please explain following

evens=[range(i) for i in range(10) if i**2 % 2 == 0] print(evens) result: [range(0,2) ,.....so on] why 0, and not just range(2)

22nd Jan 2018, 6:52 AM
Nilesh Sonawane
Nilesh Sonawane - avatar
1 Odpowiedź
+ 2
In python, there is no difference between giving the start point as a parameter to the range function, or not. It usually comes down to developer himself. You can test these codes in the code playground, which gives you a possibility to figure out and understand all these concepts without external support.
22nd Jan 2018, 7:30 AM
eRosz
eRosz - avatar