{"id":134,"date":"2022-06-28T20:14:34","date_gmt":"2022-06-29T03:14:34","guid":{"rendered":"https:\/\/teknobilly.com\/blog\/?p=134"},"modified":"2023-11-13T15:36:05","modified_gmt":"2023-11-13T23:36:05","slug":"day-3-assignment-apostrophes","status":"publish","type":"post","link":"https:\/\/teknobilly.com\/blog\/2022\/06\/28\/day-3-assignment-apostrophes\/","title":{"rendered":"Day 3 assignment &#8211; Apostrophe\u2019s"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Today&#8217;s exercise is a simple text based adventure. <a href=\"https:\/\/twitter.com\/yu_angela\">Dr Angela Yu<\/a> of the Udemy Course&nbsp;<a href=\"https:\/\/www.udemy.com\/course\/100-days-of-code\/\">100 Days of Code: The Complete Python Pro Bootcamp for 2022<\/a>&nbsp;provided&nbsp;the basic framework. I just need to copy the text, embellish it a bit, and add in the flow control to navigate through the game, resulting in a dead player, or escape the labyrinth. There are no hints on how to navigate the game to win, you need to read the code, or look at the example below.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What is the difference between &#8216; and \u2019 one is an ascii single quote that is used by code to indicate encapsulated text is a string, and the second one is punctuation. It is common to use the single quote. The&nbsp;<a href=\"https:\/\/twitter.com\/yu_angela\">evil Dr Yu<\/a>&nbsp;provide the ascii single quote throughout the examples provided. I fortunately have played this game of mismatched single quotes before and converted them first thing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">At this rate I might get through 100 days of code in a couple years, but I&#8217;m not in a hurry, and I like the slower pace. I&#8217;m also working on blogging. Having something to write everyday is a nice way to practice blog writing.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/teknobilly.com\/blog\/wp-content\/uploads\/2022\/06\/57f0ca0dc09c467c899db09f6d7308b0.png\"><img loading=\"lazy\" decoding=\"async\" width=\"646\" height=\"346\" src=\"https:\/\/teknobilly.com\/blog\/wp-content\/uploads\/2022\/06\/57f0ca0dc09c467c899db09f6d7308b0.png\" alt=\"\" class=\"wp-image-135\" title=\"\" srcset=\"https:\/\/teknobilly.com\/blog\/wp-content\/uploads\/2022\/06\/57f0ca0dc09c467c899db09f6d7308b0.png 646w, https:\/\/teknobilly.com\/blog\/wp-content\/uploads\/2022\/06\/57f0ca0dc09c467c899db09f6d7308b0-300x161.png 300w, https:\/\/teknobilly.com\/blog\/wp-content\/uploads\/2022\/06\/57f0ca0dc09c467c899db09f6d7308b0-600x321.png 600w\" sizes=\"auto, (max-width: 646px) 100vw, 646px\" \/><\/a><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>print(\"Welcome to Treasure Island.\")\nprint(\"Your mission is to find the treasure.\") \n\n#https:\/\/www.draw.io\/?lightbox=1&amp;highlight=0000ff&amp;edit=_blank&amp;layers=1&amp;nav=1&amp;title=Treasure%20Island%20Conditional.drawio#Uhttps%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D1oDe4ehjWZipYRsVfeAx2HyB7LCQ8_Fvi%26export%3Ddownload\n\n#Write your code below this line &#x1f447;\nuser_input = \"\"\nprint('You\u2019re at a crossroad. Where do you want to go?' )\nwhile user_input.lower() != \"left\":\n  user_input = input('Type \"left\" or \"right\"')\n  if (user_input.lower() == \"right\"):\n    print(\"You hear a painful cry like a little fluffy cute animal calling out for help, you jump into actual and run to the right, but you should look where you are going because you fell into a deep hole and died dead.\")\n\nprint('You\u2019re come to a lake. There is an island in the middle of the lake.')\nwhile user_input.lower() != \"wait\":\n  user_input = input('Type \"wait\" to wait for a boat. Type \"swim\" to swim across.')\n  if (user_input.lower() == 'swim'):\n    print(\"You drowned, and now you're dead\")\n  \n\nprint(\"You arrive at the island unharmed. There is a house with 3 doors. One red, one yellow and one blue.\")\nwhile user_input.lower() != 'yellow': \n  user_input = input('Which colour do you choose?')\n  if user_input.lower() == 'red':\n    print(\"It\u2019s a room full of fire. Game Over.\")\n  elif user_input.lower() == \"yellow\":    \n    print(\"You found the treasure! You Win!\")\n  elif user_input.lower() == \"blue\":\n    print(\"You get attacked by an angry trout. Game Over.\")\n  else:\n    print(\"You chose a door that doesn\u2019t exist. Game Over.\")<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This is a successful run through looks like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Welcome to Treasure Island.\nYour mission is to find the treasure.\nYou\u2019re at a crossroad. Where do you want to go?\nType \"left\" or \"right\"left\nYou\u2019re come to a lake. There is an island in the middle of the lake.\nType \"wait\" to wait for a boat. Type \"swim\" to swim across.wait\nYou arrive at the island unharmed. There is a house with 3 doors. One red, one yellow and one blue.\nWhich colour do you choose?yellow\nYou found the treasure! You Win!<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This is what happens when you enter incorrect directions:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Welcome to Treasure Island.\nYour mission is to find the treasure.\nYou\u2019re at a crossroad. Where do you want to go?\nType \"left\" or \"right\" tom\nType \"left\" or \"right\" ;et\nType \"left\" or \"right\" lft\nType \"left\" or \"right\" left\nYou\u2019re come to a lake. There is an island in the middle of the lake.\nType \"wait\" to wait for a boat. Type \"swim\" to swim across. swm\nType \"wait\" to wait for a boat. Type \"swim\" to swim across. swam\nType \"wait\" to wait for a boat. Type \"swim\" to swim across. sum\nType \"wait\" to wait for a boat. Type \"swim\" to swim across. swim\nYou drowned, and now you're dead\n&gt;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>There are no hints on how to navigate the game to win, you need to read the code<\/p>\n","protected":false},"author":2,"featured_media":137,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[13],"tags":[28,27],"class_list":["post-134","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hacking","tag-100daysofcode","tag-python","clear","fallback-thumbnail"],"jetpack_featured_media_url":"https:\/\/teknobilly.com\/blog\/wp-content\/uploads\/2022\/06\/20220628_201647.jpg","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/teknobilly.com\/blog\/wp-json\/wp\/v2\/posts\/134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/teknobilly.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/teknobilly.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/teknobilly.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/teknobilly.com\/blog\/wp-json\/wp\/v2\/comments?post=134"}],"version-history":[{"count":3,"href":"https:\/\/teknobilly.com\/blog\/wp-json\/wp\/v2\/posts\/134\/revisions"}],"predecessor-version":[{"id":140,"href":"https:\/\/teknobilly.com\/blog\/wp-json\/wp\/v2\/posts\/134\/revisions\/140"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/teknobilly.com\/blog\/wp-json\/wp\/v2\/media\/137"}],"wp:attachment":[{"href":"https:\/\/teknobilly.com\/blog\/wp-json\/wp\/v2\/media?parent=134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/teknobilly.com\/blog\/wp-json\/wp\/v2\/categories?post=134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/teknobilly.com\/blog\/wp-json\/wp\/v2\/tags?post=134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}