It gives me an empty list if I didnt put x=list(range(a, b, -1)) again in the loop while, why ?
Thanks.
If a < b
then the range will be created as an empty range. The range won't magically update when a
and b
gain new values because the values have already been assigned to the range. That's why you have to recreate the range with the updated values of a
and b
.