{"id":485,"date":"2012-11-17T14:29:19","date_gmt":"2012-11-17T20:29:19","guid":{"rendered":"http:\/\/www.insomnihack.com\/?p=485"},"modified":"2012-11-17T14:29:19","modified_gmt":"2012-11-17T20:29:19","slug":"random-kung-fu-move-name-generator-in-5-lines-of-python","status":"publish","type":"post","link":"https:\/\/www.insomnihack.com\/?p=485","title":{"rendered":"Random Kung Fu Move Name Generator in 5 Lines of Python"},"content":{"rendered":"<p>I love Python because of things like <a href=\"http:\/\/docs.python.org\/2\/library\/random.html\">random<\/a>.<a href=\"http:\/\/docs.python.org\/2\/library\/random.html#random.choice\">choice<\/a>, a useful\u00a0little method that allows you to create mission-critical functionality with very little code. For example, who doesn&#8217;t need a random Kung Fu move name at least once a week? I know I do. With Python, its a snap.<\/p>\n<p>[python]<\/p>\n<p>&gt;&gt;&gt; from random import choice<br \/>\n&gt;&gt;&gt; a = [&#8216;flying&#8217;, &#8216;thunderous&#8217;, &#8216;crushing&#8217;]<br \/>\n&gt;&gt;&gt; b = [&#8216;hammer&#8217;, &#8216;eagle&#8217;, &#8216;snake&#8217;, &#8216;dragon&#8217;, &#8216;lotus&#8217;]<br \/>\n&gt;&gt;&gt; c = [&#8216;fist&#8217;, &#8216;kick&#8217;, &#8216;palm&#8217;, &#8216;strike&#8217;]<br \/>\n&gt;&gt;&gt; &#8216; &#8216;.join([choice(a), choice(b), choice(c)])<br \/>\n&#8216;thunderous snake fist&#8217;<\/p>\n<p>[\/python]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I love Python because of things like random.choice, a useful\u00a0little method that allows you to create mission-critical functionality with very little code. For example, who doesn&#8217;t need a random Kung Fu move name at least once a week? I know I do. With Python, its a snap. [python] &gt;&gt;&gt; from random import choice &gt;&gt;&gt; a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[6],"_links":{"self":[{"href":"https:\/\/www.insomnihack.com\/index.php?rest_route=\/wp\/v2\/posts\/485"}],"collection":[{"href":"https:\/\/www.insomnihack.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.insomnihack.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.insomnihack.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.insomnihack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=485"}],"version-history":[{"count":0,"href":"https:\/\/www.insomnihack.com\/index.php?rest_route=\/wp\/v2\/posts\/485\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.insomnihack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=485"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.insomnihack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=485"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.insomnihack.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=485"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}