id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

david.white@denison.edu cs111fall2019 > permutations
prev  |  next  |  chance

Define permutations(items) to return a list of all the possible permutations (different orderings) of the items. items will be a list, and the result of permutations(items) will be a list of lists, where each one has all the elements of items, but in different order.


permutations(['A', 'B', 'C']) → [['A', 'B', 'C'], ['B', 'A', 'C'], ['B', 'C', 'A'], ['A', 'C', 'B'], ['C', 'A', 'B'], ['C', 'B', 'A']]
permutations([1, 2]) → [[1, 2], [2, 1]]
permutations(['ONE']) → [['ONE']]

...Save, Compile, Run (ctrl-enter)

def permutations(items):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 257 Post-solution available

Copyright Nick Parlante 2017 - privacy