where = lambda thing="codewar",home="home",food="dorito",phone="phone" : f"where were u wen {thing} die?\ni was at {home} eatin {food} wen {phone} ring\n\"{thing} is kil\"\n\"no\""
def where(thing="codewar", home="home", food="doorito", phone="phone"):return "\n".join(["where were u wen {} die?", "i was at {} eatin {} wen {} ring", "\"{} is kil\"", "\"no\""]).format(thing, home, food, phone, thing)- where = lambda thing="codewar",home="home",food="dorito",phone="phone" : f"where were u wen {thing} die?\ni was at {home} eatin {food} wen {phone} ring\n\"{thing} is kil\"\n\"no\""
Return all possible permutations of the array.
Return all possible permutations of the given array.
import itertools
def all_permutations(lst):
return list(itertools.permutations(lst))
import codewars_test as test
# TODO Write tests
import solution # or from solution import example
# test.assert_equals(actual, expected, [optional] message)
@test.describe("Example")
def test_group():
@test.it("test case")
def test_case():
test.assert_equals(all_permutations([1, 2, 3]), [(1, 2, 3), (1, 3, 2), (2, 1, 3), (2, 3, 1), (3, 1, 2), (3, 2, 1)])
test.assert_equals(all_permutations([1, 2]), [(1, 2), (2, 1)])
test.assert_equals(all_permutations([1]), [(1,)])
test.assert_equals(all_permutations([]), [()])
test.assert_equals(all_permutations(['w', 'i', 'n']), [('w', 'i', 'n'), ('w', 'n', 'i'), ('i', 'w', 'n'), ('i', 'n', 'w'), ('n', 'w', 'i'), ('n', 'i', 'w')])
magick_message = lambda i: 'abracadabra!' if i else 'codewarz'
import randomdef magick_message(kumite):idx = ((3, 9), (7, 6))[kumite]return '-#Vcul$a*%D&ob#8Vx!r0d~Pla,y^0ec54Px#a0w7-9d*@^%aa=+xZ0b`r3/1r-nr0za^%$g6!0'[idx[0]::idx[-1]]- magick_message = lambda i: 'abracadabra!' if i else 'codewarz'