Skip to main content
7 events
when toggle format what by license comment
Nov 15, 2016 at 14:57 comment added Peilonrayz @vkumar Sure, :) The first line changes the dictionary from say {"A": "B"} to {65: "B"} this is as str.translate looks up on the characters Unicode ordinal. If this limitation wasn't imposed by str.translate then that line wouldn't be there. The second line performs the translation on all the items in the list, as we're inputting it in the form ['abc', 'def'] rather than 'abcdef'. And is roughly equivalent to [''.join(conversion_dict[i] for i in g) for g in sequence].
Nov 15, 2016 at 14:23 vote accept vkumar
Nov 15, 2016 at 14:15 comment added vkumar @Peilonrayz, Thanks for the excellent review. I am having trouble understanding how the translate_sequence function works. Could you explain it?
Nov 15, 2016 at 12:25 comment added Peilonrayz @ChatterOne Yes you definitely could use dump_data(*convert(get_sequence())). If I edit my program I'd add that in, I just didn't think of it. :)
Nov 15, 2016 at 12:22 comment added ChatterOne Do you think that doing dump_data(convert(get_sequence())) in main would be too compact?
Nov 15, 2016 at 12:09 history edited Peilonrayz CC BY-SA 3.0
added 16 characters in body
Nov 15, 2016 at 12:03 history answered Peilonrayz CC BY-SA 3.0