I am trying to build a 2d list of test cases that contains all the possible cases ('+', '-', '*', '/') like this:
[('+', '+', '+', '+'),
('+', '+', '+', '-'),
('+', '+', '+', '/'),
('+', '+', '+', '*'),
('+', '+', '-', '-'),
('+', '+', '-', '/'),
('+', '+', '-', '*'),
('+', '+', '/', '/'),
('+', '+', '/', '*'),
('+', '+', '*', '*'),
('+', '-', '-', '-'),
('+', '-', '-', '/'),
('+', '-', '-', '*'),
('+', '-', '/', '/'),
('+', '-', '/', '*'),
('+', '-', '*', '*'),
('+', '/', '/', '/'),
('+', '/', '/', '*'),
('+', '/', '*', '*'),
('+', '*', '*', '*'),
('-', '-', '-', '-'),
('-', '-', '-', '/'),
('-', '-', '-', '*'),
('-', '-', '/', '/'),
('-', '-', '/', '*'),
('-', '-', '*', '*'),
('-', '/', '/', '/'),
('-', '/', '/', '*'),
('-', '/', '*', '*'),
('-', '*', '*', '*'),
('/', '/', '/', '/'),
('/', '/', '/', '*'),
('/', '/', '*', '*'),
('/', '*', '*', '*'),
('*', '*', '*', '*')]
I am thinking to create it in a Python list comprehension. I tried:
[[x] * 4 for x in ('+','-','*', '/')]
but the result is not something I want. Anyone knows how to do it? Thanks.