{"id":604,"date":"2016-07-22T10:56:52","date_gmt":"2016-07-22T10:56:52","guid":{"rendered":"http:\/\/learnlearn.uk\/python\/?p=604"},"modified":"2016-07-23T22:46:17","modified_gmt":"2016-07-23T22:46:17","slug":"code-a-hangman-game-in-p","status":"publish","type":"post","link":"https:\/\/learnlearn.uk\/python\/2016\/07\/22\/code-a-hangman-game-in-p\/","title":{"rendered":"Code a hangman game."},"content":{"rendered":"\n<div class=\"arconix-tabs-horizontal\"><ul class=\"arconix-tabs\"><li data-arconix-icon=\" \" data-arconix-color=\" \" class=\"arconix-tab tab-1Plan\"><a class=\"\" href=\"#tab-1Plan\">1. Plan<\/a><\/li>\n<li data-arconix-icon=\" \" data-arconix-color=\" \" class=\"arconix-tab tab-2Framework\"><a class=\"\" href=\"#tab-2Framework\">2. Framework<\/a><\/li>\n<li data-arconix-icon=\" \" data-arconix-color=\" \" class=\"arconix-tab tab-3Displaythehangman\"><a class=\"\" href=\"#tab-3Displaythehangman\">3. Display the hangman<\/a><\/li>\n<li data-arconix-icon=\" \" data-arconix-color=\" \" class=\"arconix-tab tab-4LetterInput\"><a class=\"\" href=\"#tab-4LetterInput\">4. Letter Input<\/a><\/li>\n<li data-arconix-icon=\" \" data-arconix-color=\" \" class=\"arconix-tab tab-5DisplayUsedLetters\"><a class=\"\" href=\"#tab-5DisplayUsedLetters\">5. Display Used Letters<\/a><\/li>\n<li data-arconix-icon=\" \" data-arconix-color=\" \" class=\"arconix-tab tab-6Fillinblanks\"><a class=\"\" href=\"#tab-6Fillinblanks\">6. Fill in blanks<\/a><\/li>\n<li data-arconix-icon=\" \" data-arconix-color=\" \" class=\"arconix-tab tab-7Winninglosing\"><a class=\"\" href=\"#tab-7Winninglosing\">7. Winning\/losing<\/a><\/li><\/ul>\n<div class=\"arconix-panes\"><div class=\"arconix-pane pane-1Plan\">\n<h3>Step 1 &#8211;\u00a0Make a plan.<\/h3>\n<p><a href=\"http:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/07\/Handman-plan.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignright wp-image-607 size-medium\" src=\"https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/07\/Handman-plan-300x225.png\" alt=\"Handman plan\" width=\"300\" height=\"225\" srcset=\"https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/07\/Handman-plan-300x225.png 300w, https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/07\/Handman-plan-768x576.png 768w, https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/07\/Handman-plan.png 960w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>The first thing I always do when designing a new program for the first time is I draw up a plan of what my game is going to look like. I then come up with a list of as many variables, data structures and functions that I can think of that I might want to use in my game.<\/p>\n<p>Here is my plan!<\/p>\n<p>From my plan it became clear that I would need at least the following:<\/p>\n<p><strong>Variables<\/strong><\/p>\n<div class=\"arconix-list\" data-arconix-icon=\"fa-chevron-circle-right\" data-arconix-color=\"black\">\n<ul>\n<li>The Lives left ( lives)<\/li>\n<li>The chosen word\u00a0(chosenWord)<\/li>\n<\/ul>\n<\/div>\n<p><strong>Data Structures<\/strong><\/p>\n<div class=\"arconix-list\" data-arconix-icon=\"fa-chevron-circle-right\" data-arconix-color=\"black\">\n<ul>\n<li>A List of possbile words to pick from ( wordsList)<\/li>\n<li>A list of letters that have been used<\/li>\n<li>A list of stick men icons for each stage in the hangman hanging<\/li>\n<\/ul>\n<\/div>\n<p>Functions<\/p>\n<div class=\"arconix-list\" data-arconix-icon=\"fa-chevron-circle-right\" data-arconix-color=\"black\">\n<ul>\n<li>A main screen to display the words, hangman etc (mainScreen).<\/li>\n<li>Display the hangman graphic (drawStickMan)<\/li>\n<li>Display the hidden word \/ blanks (drawTheWord)<\/li>\n<li>Display the used words (showUsedLetters)<\/li>\n<li>A letter input screen<\/li>\n<\/ul>\n<\/div>\n<p>From this I can already start to build the framework for my program. I start by creating the welcome screen function and the lists.<\/p>\n<\/div>\n<div class=\"arconix-pane pane-2Framework\">\n<h3>Step 2 &#8211; Create the framework<\/h3>\n<p>Now I&#8217;ve got a plan, I can take the plan and produce a basic outline of the game. From the drawing of the plan I can see that I am going to need a <strong>mainScreen<\/strong> function and this mainScreen function needs to display all of the main elements. Rather than try and code everything inside that one function I have created lots of little functions. This makes my code easier to read and maintain!<\/p>\n<p>&nbsp;<\/p>\n<p>At the moment none of the functions work, they just display some placeholder text on the screen to show that they are there!<br \/>\n<script src=\"https:\/\/gist.github.com\/richardbwest\/1bfbd99ef328471b9ace09a617e7e1be.js\"><\/script><\/p>\n<div class=\"arconix-toggle-wrap\"><div class=\"arconix-toggle-title toggle-closed\"><i class='fa fa-plus-square'><\/i>Version 0 Demo<\/div><div class=\"arconix-toggle-content\">\n <iframe loading=\"lazy\" src=\"https:\/\/trinket.io\/embed\/python\/6b04d7640c?toggleCode=true&amp;start=result\" width=\"100%\" height=\"600\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><br \/>\n <\/div><\/div>\n<\/div>\n<div class=\"arconix-pane pane-3Displaythehangman\">\n <div class=\"arconix-accordions arconix-accordions-vertical arconix-accordions-1\"><div class=\"arconix-accordion-title accordion-Makingthegraphic\"><i class=\"fa\"><\/i><p>Making the graphic.<\/p><\/div><div class=\"arconix-accordion-content\">\n<h3>Step 3 &#8211; Display the hangman graphic<\/h3>\n<p>In order to make the stickman we are going to use a simplified version of ascii art. This is the type of artwork that can be found on many old text games. Some of this art is very impressive but we are just creating a simple version for ours!.<\/p>\n<p><strong>Our first hangman<\/strong><\/p>\n<p>Creating hangman artwork is easy. We put our designs in a string and move on to a new line for each line.<\/p>\n<p>\\n\\ \u00a0&#8211; This is an escape sequence that puts in a newline in the string and tells Python that we want to carry on with our string on the next line.<br \/>\n<script src=\"https:\/\/gist.github.com\/richardbwest\/55d7e1045fee9dff7ea616a8cfb2263c.js\"><\/script><\/p>\n<\/div><div class=\"arconix-accordion-title accordion-Combinethegraphicsintoalist\"><i class=\"fa\"><\/i><p>Combine the graphics in  to a list<\/p><\/div><div class=\"arconix-accordion-content\">\n<h3>Combining the hangman graphics<\/h3>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignright size-full wp-image-625\" src=\"https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/07\/ezgif.com-optimize.gif\" alt=\"ezgif.com-optimize\" width=\"172\" height=\"226\" \/><\/p>\n<p>So we have created one hangman graphic, but how do we combine all the different graphics together and how do we animate them?<\/p>\n<p>Well the easiest way is just to put all the graphics together in a list and then just use indexing [], e.g. stickmen[4] , that will get the fifth element in the list, which should be the fifth \u00a0graphic!<\/p>\n<p>Next I need to display a stick figure that changes depending on how many lives the user has left!<\/p>\n<p>The clever thing about this script is that however many lives you have left, you can just use <strong>stickmen[lives]<\/strong> and it will get the correct graphic to display!<\/p>\n<p><script src=\"https:\/\/gist.github.com\/richardbwest\/b01ba95b188137ff46f9f7c3202afc1b.js\"><\/script><\/p>\n<p><div class=\"arconix-toggle-wrap\"><div class=\"arconix-toggle-title toggle-closed\"><i class='fa fa-plus-square'><\/i>Animated hangman graphic demo<\/div><div class=\"arconix-toggle-content\">\n <iframe loading=\"lazy\" src=\"https:\/\/trinket.io\/embed\/python\/2137f2c3f2\" width=\"100%\" height=\"600\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<\/div><\/div><br \/>\n <\/div><div class=\"arconix-accordion-title accordion-Addingthegraphictoourprogram\"><i class=\"fa\"><\/i><p>Adding the graphic to our program.<\/p><\/div><div class=\"arconix-accordion-content\">\n<p>Adding the hangman graphic to the program is easy.\u00a0<\/p>\n<p>You just need to add the full hangmen list to your file and then swap your existing drawStickMan function with this version. Now you program will automatically draw the correct graphic, based on the the number of lives that the player has left!<\/p>\n<p><script src=\"https:\/\/gist.github.com\/richardbwest\/9ad69f965e2716da5b99344fedd926f7.js\"><\/script><\/p>\n<p><div class=\"arconix-toggle-wrap\"><div class=\"arconix-toggle-title toggle-closed\"><i class='fa fa-plus-square'><\/i>Version 2 Demo<\/div><div class=\"arconix-toggle-content\">\n<iframe loading=\"lazy\" src=\"https:\/\/trinket.io\/embed\/python\/8b4f16b076\" width=\"100%\" height=\"600\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<\/div><\/div><br \/>\n<\/div><\/div><\/p>\n<\/div>\n<div class=\"arconix-pane pane-4LetterInput\">\n<h3>Step 4 &#8211; Get letter inputs<\/h3>\n<p>The next step is to getting letter input from the user.<br \/>\nWe could just use the input function and add the letter to the list but this has a number of problems:<\/p>\n<div class=\"arconix-list\" data-arconix-icon=\"fa-chevron-circle-right\" data-arconix-color=\"black\">\n<ul>\n<li>The user might duplicate an existing letter<\/li>\n<li>The user might enter an invalid character (e.g. 4)<\/li>\n<li>The user might enter multiple characters (e.g. fg)<\/li>\n<li>The user might enter letters in uppercase ( e.g. F)<\/li>\n<li>The user might just press enter without typing anything.<\/li>\n<\/ul>\n<\/div>\n<p>We need to create a function that can cope with all of these problems.<\/p>\n<p>A working version should:<\/p>\n<div class=\"arconix-list\" data-arconix-icon=\"fa-chevron-circle-right\" data-arconix-color=\"black\">\n<ul>\n<li>Keep asking the user until they enter a valid, unused letter.<\/li>\n<li>It must then add a lowercase version of the letter to the usedLettersList.<\/li>\n<\/ul>\n<\/div>\n<p>How do we achieve this? Well this is where our separate functions come in handy. Any time the user enters and invalid, simply refresh the screen by running mainScreen() and start again. Any time the user enters a valid entry, add that letter to the letters list, change the number of lives and rerun the mainScreen()!<\/p>\n<p><script src=\"https:\/\/gist.github.com\/richardbwest\/28cb2c7292d01428e90340e922acb21c.js\"><\/script><\/p>\n<div class=\"arconix-toggle-wrap\"><div class=\"arconix-toggle-title toggle-closed\"><i class='fa fa-plus-square'><\/i>Version 3<\/div><div class=\"arconix-toggle-content\">\n<p><script src=\"https:\/\/gist.github.com\/richardbwest\/46a646720717700277bb40cf2148516b.js\"><\/script><\/p>\n<\/div><\/div>\n<\/div>\n<div class=\"arconix-pane pane-5DisplayUsedLetters\">\n<h3>Step 4 &#8211; Display the used letters<\/h3>\n<p>We now need to show the letters that have been used. Fortunately this is super easy! Just swap you function for this one!<\/p>\n<p><script src=\"https:\/\/gist.github.com\/richardbwest\/d087998293bd66b327b1758faada0bdc.js\"><\/script><\/p>\n<p><div class=\"arconix-toggle-wrap\"><div class=\"arconix-toggle-title toggle-closed\"><i class='fa fa-plus-square'><\/i>Version 4<\/div><div class=\"arconix-toggle-content\">\n <iframe loading=\"lazy\" src=\"https:\/\/trinket.io\/embed\/python\/269d66f379\" width=\"100%\" height=\"600\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<\/div><\/div><\/div>\n<div class=\"arconix-pane pane-6Fillinblanks\">\n<h3>Step 5 &#8211; Fill in the blank letters<\/h3>\n<p>We now need to fill in the blanks. This is nice and easy, just create empty list. For each letter in the chosenWord, if the letter is in the list of usedLetters, append the letter to the word list, otherwise append an underscore _.<\/p>\n<p>Finally print out a cleaned up version of the new list.<\/p>\n<p><script src=\"https:\/\/gist.github.com\/richardbwest\/4f52ff243a1fd7a76697a4e7888891c2.js\"><\/script><\/p>\n<div class=\"arconix-toggle-wrap\"><div class=\"arconix-toggle-title toggle-closed\"><i class='fa fa-plus-square'><\/i>Version 5 Demo<\/div><div class=\"arconix-toggle-content\">\n<p><iframe loading=\"lazy\" src=\"https:\/\/trinket.io\/embed\/python\/e368f3fa51\" width=\"100%\" height=\"600\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<\/div><\/div>\n<\/div>\n<div class=\"arconix-pane pane-7Winninglosing\">\n<h3>Step 6 &#8211; Checking if the player has won or lost<\/h3>\n<p>Finally we just need to have mechanism where the game ends, dependent on one of two conditions:<\/p>\n<div class=\"arconix-list\" data-arconix-icon=\"fa-chevron-circle-right\" data-arconix-color=\"black\">\n<ul>\n<li>The player runs out of lives<\/li>\n<li>The player correctly guesses the entire word<\/li>\n<\/ul>\n<\/div>\n<p>The game needs to end and display a suitable message.<\/p>\n<p>Here is the check win \/lose script.<\/p>\n<p><script src=\"https:\/\/gist.github.com\/richardbwest\/2f9f917fc009693c18a4cdb2e28c53e4.js\"><\/script><\/p>\n<p>You will also need to add the checkWinLost function to the top of your mainScreen() function<\/p>\n<p><script src=\"https:\/\/gist.github.com\/richardbwest\/eea485b9d85615c68be4c7fb4f9a6a3b.js\"><\/script><\/p>\n<div class=\"arconix-toggle-wrap\"><div class=\"arconix-toggle-title toggle-closed\"><i class='fa fa-plus-square'><\/i>Version 6 Demo<\/div><div class=\"arconix-toggle-content\">\n<p><iframe loading=\"lazy\" src=\"https:\/\/trinket.io\/embed\/python\/e368f3fa51\" width=\"100%\" height=\"600\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<\/div><\/div>\n<\/div><\/div><\/div>\n\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":613,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":""},"categories":[4],"tags":[10,11,12,7,6,5,8,9],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Code a hangman game. - Python<\/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:\/\/learnlearn.uk\/python\/2016\/07\/22\/code-a-hangman-game-in-p\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Code a hangman game. - Python\" \/>\n<meta property=\"og:url\" content=\"https:\/\/learnlearn.uk\/python\/2016\/07\/22\/code-a-hangman-game-in-p\/\" \/>\n<meta property=\"og:site_name\" content=\"Python\" \/>\n<meta property=\"article:published_time\" content=\"2016-07-22T10:56:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-07-23T22:46:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/07\/Hangman-6.png\" \/>\n\t<meta property=\"og:image:width\" content=\"256\" \/>\n\t<meta property=\"og:image:height\" content=\"256\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"learnlearnadmin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"learnlearnadmin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/learnlearn.uk\/python\/2016\/07\/22\/code-a-hangman-game-in-p\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/learnlearn.uk\/python\/2016\/07\/22\/code-a-hangman-game-in-p\/\"},\"author\":{\"name\":\"learnlearnadmin\",\"@id\":\"https:\/\/learnlearn.uk\/python\/#\/schema\/person\/37d61760b611e12d655e20de44b12f02\"},\"headline\":\"Code a hangman game.\",\"datePublished\":\"2016-07-22T10:56:52+00:00\",\"dateModified\":\"2016-07-23T22:46:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/learnlearn.uk\/python\/2016\/07\/22\/code-a-hangman-game-in-p\/\"},\"wordCount\":1016,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/learnlearn.uk\/python\/#organization\"},\"keywords\":[\"code\",\"demo\",\"hangman\",\"project\",\"python\",\"python project\",\"tutorial\",\"walkthrough\"],\"articleSection\":[\"tutorials\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/learnlearn.uk\/python\/2016\/07\/22\/code-a-hangman-game-in-p\/\",\"url\":\"https:\/\/learnlearn.uk\/python\/2016\/07\/22\/code-a-hangman-game-in-p\/\",\"name\":\"Code a hangman game. - Python\",\"isPartOf\":{\"@id\":\"https:\/\/learnlearn.uk\/python\/#website\"},\"datePublished\":\"2016-07-22T10:56:52+00:00\",\"dateModified\":\"2016-07-23T22:46:17+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/learnlearn.uk\/python\/2016\/07\/22\/code-a-hangman-game-in-p\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/learnlearn.uk\/python\/2016\/07\/22\/code-a-hangman-game-in-p\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/learnlearn.uk\/python\/2016\/07\/22\/code-a-hangman-game-in-p\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Python Unit Home\",\"item\":\"https:\/\/learnlearn.uk\/python\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Code a hangman game.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/learnlearn.uk\/python\/#website\",\"url\":\"https:\/\/learnlearn.uk\/python\/\",\"name\":\"Python\",\"description\":\"Programming\",\"publisher\":{\"@id\":\"https:\/\/learnlearn.uk\/python\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/learnlearn.uk\/python\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/learnlearn.uk\/python\/#organization\",\"name\":\"Python\",\"url\":\"https:\/\/learnlearn.uk\/python\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/learnlearn.uk\/python\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2019\/03\/LearnLearnLogowhite.png\",\"contentUrl\":\"https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2019\/03\/LearnLearnLogowhite.png\",\"width\":710,\"height\":98,\"caption\":\"Python\"},\"image\":{\"@id\":\"https:\/\/learnlearn.uk\/python\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/learnlearn.uk\/python\/#\/schema\/person\/37d61760b611e12d655e20de44b12f02\",\"name\":\"learnlearnadmin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/learnlearn.uk\/python\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/07a2ee7e04b8bee91a78709b019de541?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/07a2ee7e04b8bee91a78709b019de541?s=96&d=mm&r=g\",\"caption\":\"learnlearnadmin\"},\"url\":\"https:\/\/learnlearn.uk\/python\/author\/learnlearnadmin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Code a hangman game. - Python","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:\/\/learnlearn.uk\/python\/2016\/07\/22\/code-a-hangman-game-in-p\/","og_locale":"en_GB","og_type":"article","og_title":"Code a hangman game. - Python","og_url":"https:\/\/learnlearn.uk\/python\/2016\/07\/22\/code-a-hangman-game-in-p\/","og_site_name":"Python","article_published_time":"2016-07-22T10:56:52+00:00","article_modified_time":"2016-07-23T22:46:17+00:00","og_image":[{"width":256,"height":256,"url":"https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/07\/Hangman-6.png","type":"image\/png"}],"author":"learnlearnadmin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"learnlearnadmin","Estimated reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/learnlearn.uk\/python\/2016\/07\/22\/code-a-hangman-game-in-p\/#article","isPartOf":{"@id":"https:\/\/learnlearn.uk\/python\/2016\/07\/22\/code-a-hangman-game-in-p\/"},"author":{"name":"learnlearnadmin","@id":"https:\/\/learnlearn.uk\/python\/#\/schema\/person\/37d61760b611e12d655e20de44b12f02"},"headline":"Code a hangman game.","datePublished":"2016-07-22T10:56:52+00:00","dateModified":"2016-07-23T22:46:17+00:00","mainEntityOfPage":{"@id":"https:\/\/learnlearn.uk\/python\/2016\/07\/22\/code-a-hangman-game-in-p\/"},"wordCount":1016,"commentCount":0,"publisher":{"@id":"https:\/\/learnlearn.uk\/python\/#organization"},"keywords":["code","demo","hangman","project","python","python project","tutorial","walkthrough"],"articleSection":["tutorials"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/learnlearn.uk\/python\/2016\/07\/22\/code-a-hangman-game-in-p\/","url":"https:\/\/learnlearn.uk\/python\/2016\/07\/22\/code-a-hangman-game-in-p\/","name":"Code a hangman game. - Python","isPartOf":{"@id":"https:\/\/learnlearn.uk\/python\/#website"},"datePublished":"2016-07-22T10:56:52+00:00","dateModified":"2016-07-23T22:46:17+00:00","breadcrumb":{"@id":"https:\/\/learnlearn.uk\/python\/2016\/07\/22\/code-a-hangman-game-in-p\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/learnlearn.uk\/python\/2016\/07\/22\/code-a-hangman-game-in-p\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/learnlearn.uk\/python\/2016\/07\/22\/code-a-hangman-game-in-p\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Python Unit Home","item":"https:\/\/learnlearn.uk\/python\/"},{"@type":"ListItem","position":2,"name":"Code a hangman game."}]},{"@type":"WebSite","@id":"https:\/\/learnlearn.uk\/python\/#website","url":"https:\/\/learnlearn.uk\/python\/","name":"Python","description":"Programming","publisher":{"@id":"https:\/\/learnlearn.uk\/python\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/learnlearn.uk\/python\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/learnlearn.uk\/python\/#organization","name":"Python","url":"https:\/\/learnlearn.uk\/python\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/learnlearn.uk\/python\/#\/schema\/logo\/image\/","url":"https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2019\/03\/LearnLearnLogowhite.png","contentUrl":"https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2019\/03\/LearnLearnLogowhite.png","width":710,"height":98,"caption":"Python"},"image":{"@id":"https:\/\/learnlearn.uk\/python\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/learnlearn.uk\/python\/#\/schema\/person\/37d61760b611e12d655e20de44b12f02","name":"learnlearnadmin","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/learnlearn.uk\/python\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/07a2ee7e04b8bee91a78709b019de541?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/07a2ee7e04b8bee91a78709b019de541?s=96&d=mm&r=g","caption":"learnlearnadmin"},"url":"https:\/\/learnlearn.uk\/python\/author\/learnlearnadmin\/"}]}},"rttpg_featured_image_url":{"full":["https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/07\/Hangman-6.png",256,256,false],"landscape":["https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/07\/Hangman-6.png",256,256,false],"portraits":["https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/07\/Hangman-6.png",256,256,false],"thumbnail":["https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/07\/Hangman-6-150x150.png",150,150,true],"medium":["https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/07\/Hangman-6.png",256,256,false],"large":["https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/07\/Hangman-6.png",256,256,false],"1536x1536":["https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/07\/Hangman-6.png",256,256,false],"2048x2048":["https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/07\/Hangman-6.png",256,256,false],"neve-blog":["https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/07\/Hangman-6.png",256,256,false]},"rttpg_author":{"display_name":"learnlearnadmin","author_link":"https:\/\/learnlearn.uk\/python\/author\/learnlearnadmin\/"},"rttpg_comment":40,"rttpg_category":"<a href=\"https:\/\/learnlearn.uk\/python\/category\/tutorials\/\" rel=\"category tag\">tutorials<\/a>","rttpg_excerpt":null,"_links":{"self":[{"href":"https:\/\/learnlearn.uk\/python\/wp-json\/wp\/v2\/posts\/604"}],"collection":[{"href":"https:\/\/learnlearn.uk\/python\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/learnlearn.uk\/python\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/learnlearn.uk\/python\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/learnlearn.uk\/python\/wp-json\/wp\/v2\/comments?post=604"}],"version-history":[{"count":0,"href":"https:\/\/learnlearn.uk\/python\/wp-json\/wp\/v2\/posts\/604\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/learnlearn.uk\/python\/wp-json\/wp\/v2\/media\/613"}],"wp:attachment":[{"href":"https:\/\/learnlearn.uk\/python\/wp-json\/wp\/v2\/media?parent=604"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/learnlearn.uk\/python\/wp-json\/wp\/v2\/categories?post=604"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/learnlearn.uk\/python\/wp-json\/wp\/v2\/tags?post=604"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}