Is it possible to have a range like this ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is it possible to have a range like this ?

range(2,100,2,2) or the maximum for the range is three characters?

25th Apr 2018, 1:10 AM
Medo Hamdani
Medo Hamdani - avatar
8 Answers
+ 3
no it's not possible. A range can only contain the beginning number, the end number and the step making it three arguments
25th Apr 2018, 4:48 AM
CodeX
CodeX - avatar
+ 2
What would your fourth argument do?
25th Apr 2018, 5:10 AM
Emma
+ 2
you'd get an error message because a range can take only three arguments
25th Apr 2018, 5:14 AM
CodeX
CodeX - avatar
+ 2
Thanks all
25th Apr 2018, 6:24 AM
Medo Hamdani
Medo Hamdani - avatar
+ 2
you're welcome
25th Apr 2018, 6:30 AM
CodeX
CodeX - avatar
+ 1
A range is normally from one number to another, with a step (or 1 if not specified)
25th Apr 2018, 1:40 AM
Emma
+ 1
Xan so it is not possible.
25th Apr 2018, 2:08 AM
Medo Hamdani
Medo Hamdani - avatar
+ 1
Jay Matthews (whispering) Where is the explanation?!
25th Apr 2018, 7:03 AM
Medo Hamdani
Medo Hamdani - avatar