How to get all the combinations of numbers in Python correctly
📁 Advanced Python Topics, AI
There is a code:
import itertools
for i in itertools.combinations_with_replacement('0123456789', 4):
print(''.join(i))
I need to get all the combinations of 4 numbers with repetitions. Part of the program output:
0000
0001
0002
0003
0005
0006
0007
0008
0009
0011
0012
0013
0014
0015
0016
0017
0018
0019
0022
0023
0024
0025
Tell me, why after 0009 there is 0011, and not 0010?
No answers yet.
Log in to leave an answer