776
Comment: converted to 1.6 markup
|
434
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
This probably shouldn't be the first example, but it's a nice one: === My requirement was I want a list of all ordered permutations of a given length of a set of tokens. Each token is a single character, and for convenience, they are passed as a string in ascending ASCII order. For example permute("abc",2) should return {{{ ["aa","ab","ac","ba","bb","bc","ca","cb","cc"] }}} and permute("13579",3) should return a list of 125 elements {{{ ["111","113", ... ,"997","999"] }}} === Ask the experienced coder to code this up in the language of his or her choice. Then show them this (contributed by castironpi): {{{ def p(a,b): if not b: return [''] return [i+j for i in a for j in p(a,b-1)] }}} ---- CategoryAdvocacy |
I'm a 39 years old and study at the high school (Biology).<<BR>> In my free time I'm trying to learn Japanese. I've been twicethere and look forward to returning anytime soon. I love to read, preferably on my [[|beloved]] Kindle. I like to watch How I Met Your Mother and Grey's [[|Anatomy]] as well as docus about anything astronomical. I like Bowling.<<BR>> <<BR>> my homepage - [[http://trade-options.net/|期权模拟账户]] |
I'm a 39 years old and study at the high school (Biology).
In my free time I'm trying to learn Japanese. I've been twicethere and look forward to returning anytime soon. I love to read, preferably on my [[|beloved]] Kindle. I like to watch How I Met Your Mother and Grey's [[|Anatomy]] as well as docus about anything astronomical. I like Bowling.
my homepage - 期权模拟账户