To get combinations of elements of a list

For example:
if the input is 1 2 3 , you have to print the output as the list of combinations of the number 1 2 3 which is [0, 1, 2, 3, 2, 3, 3, 3]

Python Implementation: