{"id":712,"date":"2016-10-02T17:07:39","date_gmt":"2016-10-02T17:07:39","guid":{"rendered":"http:\/\/learnlearn.uk\/python\/?p=712"},"modified":"2016-10-02T17:15:43","modified_gmt":"2016-10-02T17:15:43","slug":"python-rock-paper-scissors-game","status":"publish","type":"post","link":"https:\/\/learnlearn.uk\/python\/2016\/10\/02\/python-rock-paper-scissors-game\/","title":{"rendered":"Python rock, paper, scissors game"},"content":{"rendered":"\n<div class=\"arconix-tabs-horizontal\"><ul class=\"arconix-tabs\"><li data-arconix-icon=\" \" data-arconix-color=\" \" class=\"arconix-tab tab-Planning\"><a class=\"\" href=\"#tab-Planning\">Planning<\/a><\/li>\n<li data-arconix-icon=\" \" data-arconix-color=\" \" class=\"arconix-tab tab-PlayerChoice\"><a class=\"\" href=\"#tab-PlayerChoice\">Player Choice<\/a><\/li>\n<li data-arconix-icon=\" \" data-arconix-color=\" \" class=\"arconix-tab tab-ComputerChoice\"><a class=\"\" href=\"#tab-ComputerChoice\">Computer Choice<\/a><\/li>\n<li data-arconix-icon=\" \" data-arconix-color=\" \" class=\"arconix-tab tab-PlayARound\"><a class=\"\" href=\"#tab-PlayARound\">Play A Round<\/a><\/li>\n<li data-arconix-icon=\" \" data-arconix-color=\" \" class=\"arconix-tab tab-Main\"><a class=\"\" href=\"#tab-Main\">Main<\/a><\/li>\n<li data-arconix-icon=\" \" data-arconix-color=\" \" class=\"arconix-tab tab-CompleteGame\"><a class=\"\" href=\"#tab-CompleteGame\">Complete Game<\/a><\/li><\/ul>\n<div class=\"arconix-panes\"><div class=\"arconix-pane pane-Planning\">\n<h2>Python Rock Paper Scissors Game<\/h2>\n<div class=\"arconix-column-two-thirds\">\n<h3>Planning<\/h3>\n<p>The first thing that I always do before coding a larger program is plan my game. I usually get out a piece of paper and sketch out my ideas for the different functions, variables and the user interface (the text screen).<\/p>\n<\/div>\n<div class=\"arconix-column-one-third\">\n<div id=\"attachment_717\" style=\"width: 310px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/10\/rps-game-plan.jpg\"><img aria-describedby=\"caption-attachment-717\" decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-717\" src=\"https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/10\/rps-game-plan-300x225.jpg\" alt=\"Click to view full size\" width=\"300\" height=\"225\" srcset=\"https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/10\/rps-game-plan-300x225.jpg 300w, https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/10\/rps-game-plan-768x576.jpg 768w, https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/10\/rps-game-plan-600x450.jpg 600w, https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/10\/rps-game-plan.jpg 960w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-717\" class=\"wp-caption-text\">Click to view full size<\/p><\/div>\n<\/div>\n<\/div>\n<div class=\"arconix-pane pane-PlayerChoice\">\n<h3>Player Choice Function<\/h3>\n<p>The first function that we are going to develop is the playerChoice() function.<\/p>\n<p>This function will:<\/p>\n<div class=\"arconix-list\" data-arconix-icon=\"fa-chevron-circle-right\" data-arconix-color=\"black\">\n<ul>\n<li>Ask the user for an input<\/li>\n<li>Check if it is an acceptable input<\/li>\n<li>If it isn&#8217;t repeat the process of asking<\/li>\n<li>If it is, return either rock, scissors or paper.<\/li>\n<\/ul>\n<\/div>\n<p><script src=\"https:\/\/gist.github.com\/richardbwest\/13c6748ff1815b8c2220c2b5aa6574cb.js\"><\/script><\/p>\n<\/div>\n<div class=\"arconix-pane pane-ComputerChoice\">\n<h3>Computer Choice Function<\/h3>\n<p>The next function we will create is the computer choice function<\/p>\n<p>This function will:<\/p>\n<div class=\"arconix-list\" data-arconix-icon=\"fa-chevron-circle-right\" data-arconix-color=\"black\">\n<ul>\n<li>Pick a random choice from the list [&#8220;rock&#8221;,&#8221;paper&#8221;,&#8221;scissors&#8221;]<\/li>\n<li>Return the choice<\/li>\n<\/ul>\n<\/div>\n<p><script src=\"https:\/\/gist.github.com\/richardbwest\/fdd9bbf1db77fe110557049bc869ed7e.js\"><\/script><\/p>\n<\/div>\n<div class=\"arconix-pane pane-PlayARound\">\n<h3>Play a round function<\/h3>\n<p>The next part of our program is the play a round function. Here we will start to combine the other functions to make a basic working version of the game.<\/p>\n<p><script src=\"https:\/\/gist.github.com\/richardbwest\/766c3b3fdb3d256b5ca4ababbedb5ab8.js\"><\/script><br \/>\n <\/div>\n<div class=\"arconix-pane pane-Main\">\n<h3>Main Function<\/h3>\n<p>Finally we pull the whole thing together with a main function. The job of this function is to:<\/p>\n<ul>\n<li>Run the code for each \u00a0round<\/li>\n<li>Keep track of the round<\/li>\n<li>Keep track of the score<\/li>\n<li>Print out the final score<\/li>\n<\/ul>\n<p><script src=\"https:\/\/gist.github.com\/richardbwest\/4f08cd5a075a16dd4deffe304f412364.js\"><\/script><br \/>\n<\/div>\n<div class=\"arconix-pane pane-CompleteGame\">\n<h3>Complete Game Code<\/h3>\n<p><script src=\"https:\/\/gist.github.com\/richardbwest\/deb1a4f3fa770fd479200660c3f0c231.js\"><\/script><\/p>\n<\/div><\/div><\/div>\n\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;<\/p>\n","protected":false},"author":1,"featured_media":715,"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":[1],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python rock, paper, scissors game - Python<\/title>\n<meta name=\"description\" content=\"Free online tutorial on how to make a Python Paper, Scissors game. Step by Step instructions and full code listings. Ideal for GCSE coding practice.\" \/>\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\/10\/02\/python-rock-paper-scissors-game\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python rock, paper, scissors game - Python\" \/>\n<meta property=\"og:description\" content=\"Free online tutorial on how to make a Python Paper, Scissors game. Step by Step instructions and full code listings. Ideal for GCSE coding practice.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/learnlearn.uk\/python\/2016\/10\/02\/python-rock-paper-scissors-game\/\" \/>\n<meta property=\"og:site_name\" content=\"Python\" \/>\n<meta property=\"article:published_time\" content=\"2016-10-02T17:07:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-10-02T17:15:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/10\/rock-paper-scissors-156171_640.png\" \/>\n\t<meta property=\"og:image:width\" content=\"640\" \/>\n\t<meta property=\"og:image:height\" content=\"631\" \/>\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=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/learnlearn.uk\/python\/2016\/10\/02\/python-rock-paper-scissors-game\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/learnlearn.uk\/python\/2016\/10\/02\/python-rock-paper-scissors-game\/\"},\"author\":{\"name\":\"learnlearnadmin\",\"@id\":\"https:\/\/learnlearn.uk\/python\/#\/schema\/person\/37d61760b611e12d655e20de44b12f02\"},\"headline\":\"Python rock, paper, scissors game\",\"datePublished\":\"2016-10-02T17:07:39+00:00\",\"dateModified\":\"2016-10-02T17:15:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/learnlearn.uk\/python\/2016\/10\/02\/python-rock-paper-scissors-game\/\"},\"wordCount\":262,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/learnlearn.uk\/python\/#organization\"},\"articleSection\":[\"Uncategorized\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/learnlearn.uk\/python\/2016\/10\/02\/python-rock-paper-scissors-game\/\",\"url\":\"https:\/\/learnlearn.uk\/python\/2016\/10\/02\/python-rock-paper-scissors-game\/\",\"name\":\"Python rock, paper, scissors game - Python\",\"isPartOf\":{\"@id\":\"https:\/\/learnlearn.uk\/python\/#website\"},\"datePublished\":\"2016-10-02T17:07:39+00:00\",\"dateModified\":\"2016-10-02T17:15:43+00:00\",\"description\":\"Free online tutorial on how to make a Python Paper, Scissors game. Step by Step instructions and full code listings. Ideal for GCSE coding practice.\",\"breadcrumb\":{\"@id\":\"https:\/\/learnlearn.uk\/python\/2016\/10\/02\/python-rock-paper-scissors-game\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/learnlearn.uk\/python\/2016\/10\/02\/python-rock-paper-scissors-game\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/learnlearn.uk\/python\/2016\/10\/02\/python-rock-paper-scissors-game\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Python Unit Home\",\"item\":\"https:\/\/learnlearn.uk\/python\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python rock, paper, scissors 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":"Python rock, paper, scissors game - Python","description":"Free online tutorial on how to make a Python Paper, Scissors game. Step by Step instructions and full code listings. Ideal for GCSE coding practice.","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\/10\/02\/python-rock-paper-scissors-game\/","og_locale":"en_GB","og_type":"article","og_title":"Python rock, paper, scissors game - Python","og_description":"Free online tutorial on how to make a Python Paper, Scissors game. Step by Step instructions and full code listings. Ideal for GCSE coding practice.","og_url":"https:\/\/learnlearn.uk\/python\/2016\/10\/02\/python-rock-paper-scissors-game\/","og_site_name":"Python","article_published_time":"2016-10-02T17:07:39+00:00","article_modified_time":"2016-10-02T17:15:43+00:00","og_image":[{"width":640,"height":631,"url":"https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/10\/rock-paper-scissors-156171_640.png","type":"image\/png"}],"author":"learnlearnadmin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"learnlearnadmin","Estimated reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/learnlearn.uk\/python\/2016\/10\/02\/python-rock-paper-scissors-game\/#article","isPartOf":{"@id":"https:\/\/learnlearn.uk\/python\/2016\/10\/02\/python-rock-paper-scissors-game\/"},"author":{"name":"learnlearnadmin","@id":"https:\/\/learnlearn.uk\/python\/#\/schema\/person\/37d61760b611e12d655e20de44b12f02"},"headline":"Python rock, paper, scissors game","datePublished":"2016-10-02T17:07:39+00:00","dateModified":"2016-10-02T17:15:43+00:00","mainEntityOfPage":{"@id":"https:\/\/learnlearn.uk\/python\/2016\/10\/02\/python-rock-paper-scissors-game\/"},"wordCount":262,"commentCount":0,"publisher":{"@id":"https:\/\/learnlearn.uk\/python\/#organization"},"articleSection":["Uncategorized"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/learnlearn.uk\/python\/2016\/10\/02\/python-rock-paper-scissors-game\/","url":"https:\/\/learnlearn.uk\/python\/2016\/10\/02\/python-rock-paper-scissors-game\/","name":"Python rock, paper, scissors game - Python","isPartOf":{"@id":"https:\/\/learnlearn.uk\/python\/#website"},"datePublished":"2016-10-02T17:07:39+00:00","dateModified":"2016-10-02T17:15:43+00:00","description":"Free online tutorial on how to make a Python Paper, Scissors game. Step by Step instructions and full code listings. Ideal for GCSE coding practice.","breadcrumb":{"@id":"https:\/\/learnlearn.uk\/python\/2016\/10\/02\/python-rock-paper-scissors-game\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/learnlearn.uk\/python\/2016\/10\/02\/python-rock-paper-scissors-game\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/learnlearn.uk\/python\/2016\/10\/02\/python-rock-paper-scissors-game\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Python Unit Home","item":"https:\/\/learnlearn.uk\/python\/"},{"@type":"ListItem","position":2,"name":"Python rock, paper, scissors 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\/10\/rock-paper-scissors-156171_640.png",640,631,false],"landscape":["https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/10\/rock-paper-scissors-156171_640.png",640,631,false],"portraits":["https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/10\/rock-paper-scissors-156171_640.png",640,631,false],"thumbnail":["https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/10\/rock-paper-scissors-156171_640-150x150.png",150,150,true],"medium":["https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/10\/rock-paper-scissors-156171_640-300x296.png",300,296,true],"large":["https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/10\/rock-paper-scissors-156171_640.png",640,631,false],"1536x1536":["https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/10\/rock-paper-scissors-156171_640.png",640,631,false],"2048x2048":["https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/10\/rock-paper-scissors-156171_640.png",640,631,false],"neve-blog":["https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2016\/10\/rock-paper-scissors-156171_640.png",629,620,false]},"rttpg_author":{"display_name":"learnlearnadmin","author_link":"https:\/\/learnlearn.uk\/python\/author\/learnlearnadmin\/"},"rttpg_comment":10,"rttpg_category":"<a href=\"https:\/\/learnlearn.uk\/python\/category\/uncategorized\/\" rel=\"category tag\">Uncategorized<\/a>","rttpg_excerpt":"&nbsp;","_links":{"self":[{"href":"https:\/\/learnlearn.uk\/python\/wp-json\/wp\/v2\/posts\/712"}],"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=712"}],"version-history":[{"count":0,"href":"https:\/\/learnlearn.uk\/python\/wp-json\/wp\/v2\/posts\/712\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/learnlearn.uk\/python\/wp-json\/wp\/v2\/media\/715"}],"wp:attachment":[{"href":"https:\/\/learnlearn.uk\/python\/wp-json\/wp\/v2\/media?parent=712"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/learnlearn.uk\/python\/wp-json\/wp\/v2\/categories?post=712"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/learnlearn.uk\/python\/wp-json\/wp\/v2\/tags?post=712"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}