0

even number=list(range)(2,11,2).why range function takes third argument in range or step size starting from 2 not 1.

Python

10th Jan 2023, 8:54 AM
janvi vashistha
2 ответов
+ 3
The method has more overloads (possibilities). One of this as above mentioned. First argument is here the start value and the last step.
10th Jan 2023, 9:00 AM
JaScript
JaScript - avatar
+ 2
When not explicitly specified, range() uses 1 for stepping as default. even_number = list( range( 2, 11, 2 ) ) means the `list` will be populated with values from 2 up to 11 exclusively, and each value inserted to the `list` will dffer by 2 ~ the stepping value.
10th Jan 2023, 9:02 AM
Ipang