Why it is giving ouput as [] ? Where as range(0,11,1) is giving desired output? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why it is giving ouput as [] ? Where as range(0,11,1) is giving desired output?

rom itertools import product, permutations letters = ("A", "B") print(list(product(letters, range(0,11,-1))))

6th Mar 2020, 9:37 PM
Ana
4 Answers
+ 3
You have written -1 in range as step. Just clear it.
6th Mar 2020, 10:40 PM
Qasem
+ 3
Because the route from 0 to 10 is straight. You can write range (10, -1, -1)
6th Mar 2020, 10:43 PM
Qasem
+ 2
Why didn't it print those in reverse oder?
6th Mar 2020, 10:42 PM
Ana
+ 2
Thank you 😊
6th Mar 2020, 10:47 PM
Ana