Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок+ 2
Why is the output [], and not an error?
numbers = list(range(20,5, 2)) print(numbers)
7 ответов
+ 7
uuufffffff
finally the answer is:
Guido decided so.
Guido invented Python.
+ 4
иван but you are right
it could be handled as error.
Simply a question of which way is better.
+ 3
list() will return empty list..
You code also return empty list.
So not error since assigning empty list..
And also since there no syntax error, it won't be raise error.. There is only logical error of programmer in case if it is wrong..
+ 2
Because the third parameter in the range accepts an integer, and the range here will start from 20 and ends at 5, but step count is +ve 2, therefore it cannot find any value so it returns a blank list
+ 1
Tamy 😝 I know the question was different ..
0
If you want to start the range in 20 and finish it in 5, your step should be -2 instead of +2.