{"id":124,"date":"2024-09-13T14:23:03","date_gmt":"2024-09-13T14:23:03","guid":{"rendered":"https:\/\/theroyalscode.com\/students\/a_carpenter\/?p=124"},"modified":"2024-09-13T14:23:03","modified_gmt":"2024-09-13T14:23:03","slug":"rps-py","status":"publish","type":"post","link":"https:\/\/theroyalscode.com\/students\/a_carpenter\/2024\/09\/13\/rps-py\/","title":{"rendered":"Rps.py"},"content":{"rendered":"\n<p><strong>I made a rock paper scissors game on python today. It is a simple random loop of basic inputs and responses. Here is the code. <\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import random\n\noptions = (\"rock\", \"paper\", \"scissors\")\nrunning = True\n\nwhile running:\n\n    player = input(\"Enter a choice >\")\n    computer = random.choice(options)\n    \n    while player != options:\n        print(\"bad boy\")\n        player = input(\"Enter a choice >\")\n\n    print(f\"Player: {player}\")\n    print(f\"Computer: {computer}\")\n\n    if player == computer:\n        print(\"It's a tie!\")\n    elif player == \"rock\" and computer == \"scissors\":\n        print(\"You win!\")\n    elif player == \"paper\" and computer == \"rock\":\n        print(\"You win!\")\n    elif player == \"scissors\" and computer == \"paper\":\n        print(\"You win!\")\n    else:\n        print(\"You lose!\")\n\n    if not input(\"Play again? (y\/n): \").lower() == \"y\":\n        running = False\n\nprint(\"Thanks for playing!\")<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I made a rock paper scissors game on python today. It is a simple random loop of basic inputs and responses. Here is the code.<\/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-124","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/theroyalscode.com\/students\/a_carpenter\/wp-json\/wp\/v2\/posts\/124","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theroyalscode.com\/students\/a_carpenter\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theroyalscode.com\/students\/a_carpenter\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/a_carpenter\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/a_carpenter\/wp-json\/wp\/v2\/comments?post=124"}],"version-history":[{"count":1,"href":"https:\/\/theroyalscode.com\/students\/a_carpenter\/wp-json\/wp\/v2\/posts\/124\/revisions"}],"predecessor-version":[{"id":125,"href":"https:\/\/theroyalscode.com\/students\/a_carpenter\/wp-json\/wp\/v2\/posts\/124\/revisions\/125"}],"wp:attachment":[{"href":"https:\/\/theroyalscode.com\/students\/a_carpenter\/wp-json\/wp\/v2\/media?parent=124"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/a_carpenter\/wp-json\/wp\/v2\/categories?post=124"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/a_carpenter\/wp-json\/wp\/v2\/tags?post=124"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}