# In this week's lectures, we discussed an iterative approach to generating all sequences of outcomes where repeated outcomes were allowed. Starting from this program template, implement a function gen_permutations(outcomes, num_trials) that takes a list of outcomes and a number of trials and returns a set of all possible permutations of length num_trials (encoded as tuples) from this set of outcomes. Hint: gen_permutations can be built from gen_all_sequences by adding a single if statement that prevents repeated outcomes. When you believe that your code works correctly, select the answer printed at the bottom of the console.

## Home » In this week’s lectures, we discussed an iterative approach to generating all sequences of outcomes where repeated outcomes were allowed. Starting from this program template, implement a function gen_permutations(outcomes, num_trials) that takes a list of outcomes and a number of trials and returns a set of all possible permutations of length num_trials (encoded as tuples) from this set of outcomes. Hint: gen_permutations can be built from gen_all_sequences by adding a single if statement that prevents repeated outcomes. When you believe that your code works correctly, select the answer printed at the bottom of the console.

Practice More Questions From: Homework 4

## Q:

### Subsets A set SS is a subset of another set TT (mathematically denoted as S \subseteq TS⊆T) if every element xx in SS (mathematically denoted as x \in Sx∈S) is also a member of TT. Which of the following sets are subsets of the set \{1, 2\}{1,2}?

Subscribe
Notify of 