Cartesian Product

Calculates the cartesian product of multiple sets of data, returning all possible combinations.

Input: TextResult: Text

Text input

Tool options

Examples

Cartesian Product

Input

1 2 3 4 5

a b c d e

Expected answer

(1,a) (1,b) (1,c) (1,d) (1,e) (2,a) (2,b) (2,c) (2,d) (2,e) (3,a) (3,b) (3,c) (3,d) (3,e) (4,a) (4,b) (4,c) (4,d) (4,e) (5,a) (5,b) (5,c) (5,d) (5,e)
Sample delimiter
Item delimiter
item delimiter

Input

1-2-3-4-5

a-b-c-d-e

Expected answer

(1,a)-(1,b)-(1,c)-(1,d)-(1,e)-(2,a)-(2,b)-(2,c)-(2,d)-(2,e)-(3,a)-(3,b)-(3,c)-(3,d)-(3,e)-(4,a)-(4,b)-(4,c)-(4,d)-(4,e)-(5,a)-(5,b)-(5,c)-(5,d)-(5,e)
Sample delimiter
Item delimiter
-
sample delimiter

Input

1 2 3 4 5_a b c d e

Expected answer

(1,a) (1,b) (1,c) (1,d) (1,e) (2,a) (2,b) (2,c) (2,d) (2,e) (3,a) (3,b) (3,c) (3,d) (3,e) (4,a) (4,b) (4,c) (4,d) (4,e) (5,a) (5,b) (5,c) (5,d) (5,e)
Sample delimiter
_
Item delimiter
too many on left

Input

1 2 3 4 5 6

a b c d e

Expected answer

(1,a) (1,b) (1,c) (1,d) (1,e) (2,a) (2,b) (2,c) (2,d) (2,e) (3,a) (3,b) (3,c) (3,d) (3,e) (4,a) (4,b) (4,c) (4,d) (4,e) (5,a) (5,b) (5,c) (5,d) (5,e) (6,a) (6,b) (6,c) (6,d) (6,e)
Sample delimiter
Item delimiter
too many on right

Input

1 2 3 4 5

a b c d e f

Expected answer

(1,a) (1,b) (1,c) (1,d) (1,e) (1,f) (2,a) (2,b) (2,c) (2,d) (2,e) (2,f) (3,a) (3,b) (3,c) (3,d) (3,e) (3,f) (4,a) (4,b) (4,c) (4,d) (4,e) (4,f) (5,a) (5,b) (5,c) (5,d) (5,e) (5,f)
Sample delimiter
Item delimiter

Format reference: Cartesian Product background and specification

Parameters

ParameterDefault valueInput and choices
Sample delimiter"\\n\\n"Escape sequences such as \n, \r and \t are supported
Item delimiter","Escape sequences such as \n, \r and \t are supported

Related tools

Browse arithmetic / logic tools