psychopy_ext.exp.combinations_with_replacement(iterable, r)[source]

Produces combinations of iterable elements of length r with replacement: identical elements can occur in together in some combinations.

Example: combinations_with_replacement(‘ABC’, 2) –> AA AB AC BB BC CC

From Python 2.6 docs under the Python Software Foundation License

  • iterable

    A list-like or a str-like object that contains some elements

  • r

    Number of elements in each ouput combination


A generator yielding combinations (with replacement) of length r