{"id":42416,"date":"2021-09-01T09:54:15","date_gmt":"2021-09-01T07:54:15","guid":{"rendered":"https:\/\/eiposgrados.com\/?p=42416"},"modified":"2021-10-29T16:04:23","modified_gmt":"2021-10-29T14:04:23","slug":"how-to-make-rock-paper-scissors-in-python","status":"publish","type":"post","link":"https:\/\/eiposgrados.com\/eng\/python-blog\/how-to-make-rock-paper-scissors-in-python\/","title":{"rendered":"\u201cRock, Paper, Scissors\u201d with Python"},"content":{"rendered":"<p>Today we are going to teach you how to program the mythical rock, paper, scissors with a simple code.<\/p>\n\n\n\n<p>Python is one of the most powerful and used languages today. He&nbsp;<a href=\"https:\/\/eiposgrados.com\/eng\/master-in-python\/\" data-type=\"URL\" data-id=\"https:\/\/eiposgrados.com\/master-en-python\/\">Master in Advanced Programming in Python<\/a>&nbsp;will train you to be a&nbsp;<strong>programmer expert&nbsp;<\/strong>in areas as prominent and current as&nbsp;<strong>Big Data, Hacking, Machine Learning.<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">random method<\/h2>\n\n\n\n<p>We will use the<strong> random method<\/strong> so that it automatically generates the \u201cplay\u201d of the machine.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img fetchpriority=\"high\" decoding=\"async\" src=\"https:\/\/eiposgrados.com\/wp-content\/uploads\/2021\/09\/programar-piedra-papel-tijera-en-python-578x1024.png\" alt=\"\" class=\"wp-image-42423\" width=\"452\" height=\"800\" title=\"\"><\/figure><\/div>\n\n\n\n<p><strong>The code is very simple<\/strong>On the one hand, we generate a random number with random between 0 and 3 that will be the machine&#039;s move. Then with a simple menu we will make our choice and then we just have to consider all the options with the if conditional.<\/p>\n\n\n\n<p>On the other hand, if we want to play several times, we will only have to enter a <strong>while loop<\/strong> in the game with the typical yes or no question at the end.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/eiposgrados.com\/wp-content\/uploads\/2021\/09\/python-piedra-papel-tijera.png\" alt=\"\" class=\"wp-image-42422\" title=\"\"><\/figure><\/div>\n\n\n\n<p>So our <strong>complete code<\/strong> It would look like this:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/eiposgrados.com\/wp-content\/uploads\/2021\/09\/piedra-papel-tijera-en-python.png\" alt=\"\" class=\"wp-image-42421\" width=\"461\" height=\"754\" title=\"\"><\/figure><\/div>","protected":false},"excerpt":{"rendered":"<p>Today we teach you how to make rock paper scissors in Python in a very simple way and with a very simple code. Forward!<\/p>","protected":false},"author":1,"featured_media":51563,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[407],"tags":[],"class_list":["post-42416","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog-python"],"acf":[],"_links":{"self":[{"href":"https:\/\/eiposgrados.com\/eng\/wp-json\/wp\/v2\/posts\/42416","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eiposgrados.com\/eng\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eiposgrados.com\/eng\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eiposgrados.com\/eng\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/eiposgrados.com\/eng\/wp-json\/wp\/v2\/comments?post=42416"}],"version-history":[{"count":0,"href":"https:\/\/eiposgrados.com\/eng\/wp-json\/wp\/v2\/posts\/42416\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/eiposgrados.com\/eng\/wp-json\/wp\/v2\/media\/51563"}],"wp:attachment":[{"href":"https:\/\/eiposgrados.com\/eng\/wp-json\/wp\/v2\/media?parent=42416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eiposgrados.com\/eng\/wp-json\/wp\/v2\/categories?post=42416"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eiposgrados.com\/eng\/wp-json\/wp\/v2\/tags?post=42416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}