{"id":999,"date":"2020-05-12T06:31:43","date_gmt":"2020-05-12T06:31:43","guid":{"rendered":"https:\/\/www.projectimmerse.com\/blog\/?p=999"},"modified":"2020-06-15T07:12:41","modified_gmt":"2020-06-15T07:12:41","slug":"permutations-using-python","status":"publish","type":"post","link":"https:\/\/www.projectimmerse.com\/blog\/permutations-using-python\/","title":{"rendered":"Permutations Using Python"},"content":{"rendered":"<p>How&#8217;s it going everyone?!?<\/p>\n<p>I hope your week has been great and staying healthy. Today I am going to talk about permutations using Python.\u00a0The version that I am going to use for this program is Python 3.8.3.<\/p>\n<p>Well, what are permutations????? Permutations in mathematics basically are just different combinations of a sequence, and that is exactly what we are going to do. We are going generate a random sequence of integers and find different combos for this sequence!<\/p>\n<p><!--more--><\/p>\n<p>Obviously, there are always different ways to tackle a problem, but for this one, since Python already has a package for us to utilize, we can just import it instead! One of my number one rules is to never reinvent the wheel, it makes our jobs as programmers easier.<\/p>\n<p>The code below demonstrates how you could write a simple permutations function and list out everything for that sequence. Remember, another rule of mine is this, always test your code! If your code lines are like hundreds to thousand lines, it&#8217;d be wise for you to test out different chunks of code and see if everything is working as you expect it to be!<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\n\r\n# import the necessary package\r\nfrom itertools import permutations\r\n\r\n# defining the function\r\ndef findPermutations(combo):\r\n    \r\n    #use permutations method\r\n    my_list = permutations(combo)\r\n\r\n    for i in my_list:\r\n        print(i)\r\n\r\n\r\n# ask user to input sequence of numbers\r\nmy_list = input(&quot;Enter a list of numbers separated by a space: &quot;)\r\nmy_list = my_list.split()\r\n\r\n# convert all to intengers\r\nfor i in range(0, len(my_list)):\r\n    my_list&#x5B;i] = int(my_list&#x5B;i])\r\n\r\n# calling on the function findPermutations\r\nfindPermutations(my_list)\r\n\r\n<\/pre>\n<p>I hope this small program makes sense and helps you in some way. If you have any question, please feel free to ask! Stay tuned for more and have a blessed day!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How&#8217;s it going everyone?!? I hope your week has been great and staying healthy. Today I am going to talk about permutations using Python.\u00a0The version that I am going to use for this program is Python 3.8.3. Well, what are permutations????? Permutations in mathematics basically are just different combinations of a sequence, and that is &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.projectimmerse.com\/blog\/permutations-using-python\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Permutations Using Python&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-999","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Permutations Using Python - Project Immerse<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.projectimmerse.com\/blog\/permutations-using-python\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Permutations Using Python - Project Immerse\" \/>\n<meta property=\"og:description\" content=\"How&#8217;s it going everyone?!? I hope your week has been great and staying healthy. Today I am going to talk about permutations using Python.\u00a0The version that I am going to use for this program is Python 3.8.3. Well, what are permutations????? Permutations in mathematics basically are just different combinations of a sequence, and that is &hellip; Continue reading &quot;Permutations Using Python&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.projectimmerse.com\/blog\/permutations-using-python\/\" \/>\n<meta property=\"og:site_name\" content=\"Project Immerse\" \/>\n<meta property=\"article:published_time\" content=\"2020-05-12T06:31:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-06-15T07:12:41+00:00\" \/>\n<meta name=\"author\" content=\"projectimmerse\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"projectimmerse\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/permutations-using-python\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/permutations-using-python\\\/\"},\"author\":{\"name\":\"projectimmerse\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#\\\/schema\\\/person\\\/c53f2864be524ee6fa08a7e4800dd1e5\"},\"headline\":\"Permutations Using Python\",\"datePublished\":\"2020-05-12T06:31:43+00:00\",\"dateModified\":\"2020-06-15T07:12:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/permutations-using-python\\\/\"},\"wordCount\":310,\"commentCount\":0,\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/permutations-using-python\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/permutations-using-python\\\/\",\"url\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/permutations-using-python\\\/\",\"name\":\"Permutations Using Python - Project Immerse\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#website\"},\"datePublished\":\"2020-05-12T06:31:43+00:00\",\"dateModified\":\"2020-06-15T07:12:41+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#\\\/schema\\\/person\\\/c53f2864be524ee6fa08a7e4800dd1e5\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/permutations-using-python\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/permutations-using-python\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/permutations-using-python\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Permutations Using Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/\",\"name\":\"Project Immerse\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#\\\/schema\\\/person\\\/c53f2864be524ee6fa08a7e4800dd1e5\",\"name\":\"projectimmerse\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g\",\"caption\":\"projectimmerse\"},\"url\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/author\\\/projectimmerse\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Permutations Using Python - Project Immerse","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.projectimmerse.com\/blog\/permutations-using-python\/","og_locale":"en_US","og_type":"article","og_title":"Permutations Using Python - Project Immerse","og_description":"How&#8217;s it going everyone?!? I hope your week has been great and staying healthy. Today I am going to talk about permutations using Python.\u00a0The version that I am going to use for this program is Python 3.8.3. Well, what are permutations????? Permutations in mathematics basically are just different combinations of a sequence, and that is &hellip; Continue reading \"Permutations Using Python\"","og_url":"https:\/\/www.projectimmerse.com\/blog\/permutations-using-python\/","og_site_name":"Project Immerse","article_published_time":"2020-05-12T06:31:43+00:00","article_modified_time":"2020-06-15T07:12:41+00:00","author":"projectimmerse","twitter_card":"summary_large_image","twitter_misc":{"Written by":"projectimmerse","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.projectimmerse.com\/blog\/permutations-using-python\/#article","isPartOf":{"@id":"https:\/\/www.projectimmerse.com\/blog\/permutations-using-python\/"},"author":{"name":"projectimmerse","@id":"https:\/\/www.projectimmerse.com\/blog\/#\/schema\/person\/c53f2864be524ee6fa08a7e4800dd1e5"},"headline":"Permutations Using Python","datePublished":"2020-05-12T06:31:43+00:00","dateModified":"2020-06-15T07:12:41+00:00","mainEntityOfPage":{"@id":"https:\/\/www.projectimmerse.com\/blog\/permutations-using-python\/"},"wordCount":310,"commentCount":0,"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.projectimmerse.com\/blog\/permutations-using-python\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.projectimmerse.com\/blog\/permutations-using-python\/","url":"https:\/\/www.projectimmerse.com\/blog\/permutations-using-python\/","name":"Permutations Using Python - Project Immerse","isPartOf":{"@id":"https:\/\/www.projectimmerse.com\/blog\/#website"},"datePublished":"2020-05-12T06:31:43+00:00","dateModified":"2020-06-15T07:12:41+00:00","author":{"@id":"https:\/\/www.projectimmerse.com\/blog\/#\/schema\/person\/c53f2864be524ee6fa08a7e4800dd1e5"},"breadcrumb":{"@id":"https:\/\/www.projectimmerse.com\/blog\/permutations-using-python\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.projectimmerse.com\/blog\/permutations-using-python\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.projectimmerse.com\/blog\/permutations-using-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.projectimmerse.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Permutations Using Python"}]},{"@type":"WebSite","@id":"https:\/\/www.projectimmerse.com\/blog\/#website","url":"https:\/\/www.projectimmerse.com\/blog\/","name":"Project Immerse","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.projectimmerse.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.projectimmerse.com\/blog\/#\/schema\/person\/c53f2864be524ee6fa08a7e4800dd1e5","name":"projectimmerse","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g","caption":"projectimmerse"},"url":"https:\/\/www.projectimmerse.com\/blog\/author\/projectimmerse\/"}]}},"_links":{"self":[{"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/posts\/999","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/comments?post=999"}],"version-history":[{"count":8,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/posts\/999\/revisions"}],"predecessor-version":[{"id":1081,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/posts\/999\/revisions\/1081"}],"wp:attachment":[{"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/media?parent=999"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/categories?post=999"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/tags?post=999"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}