{"id":36542,"date":"2017-01-30T07:58:27","date_gmt":"2017-01-30T13:58:27","guid":{"rendered":"https:\/\/kenscourses.com\/tc1014winter2017\/?p=36542"},"modified":"2017-01-30T07:58:27","modified_gmt":"2017-01-30T13:58:27","slug":"wsq-03-pick-a-number-week-04","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc1014winter2017\/instructor\/wsq-03-pick-a-number-week-04\/","title":{"rendered":"WSQ 03 \u2013 Pick a Number (Week 04)"},"content":{"rendered":"<h2>What to Do<\/h2>\n<div id=\"attachment_2926\" class=\"wp-caption alignleft\">\n<p><a href=\"https:\/\/www.flickr.com\/photos\/dasprid\/8147975983\/\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2926 size-medium\" src=\"https:\/\/i2.wp.com\/kenscourses.com\/tc101winter2015\/wp-content\/uploads\/2015\/02\/8147975983_360e685a22_k.jpg?resize=200%2C300\" sizes=\"auto, (max-width: 200px) 100vw, 200px\" srcset=\"https:\/\/i2.wp.com\/kenscourses.com\/tc101winter2015\/wp-content\/uploads\/2015\/02\/8147975983_360e685a22_k.jpg?resize=200%2C300 200w, https:\/\/i2.wp.com\/kenscourses.com\/tc101winter2015\/wp-content\/uploads\/2015\/02\/8147975983_360e685a22_k.jpg?resize=682%2C1024 682w, https:\/\/i2.wp.com\/kenscourses.com\/tc101winter2015\/wp-content\/uploads\/2015\/02\/8147975983_360e685a22_k.jpg?resize=532%2C800 532w, https:\/\/i2.wp.com\/kenscourses.com\/tc101winter2015\/wp-content\/uploads\/2015\/02\/8147975983_360e685a22_k.jpg?w=1363 1363w, https:\/\/i2.wp.com\/kenscourses.com\/tc101winter2015\/wp-content\/uploads\/2015\/02\/8147975983_360e685a22_k.jpg?w=1000 1000w\" alt=\"https:\/\/www.flickr.com\/photos\/dasprid\/8147975983\/\" width=\"200\" height=\"300\" data-attachment-id=\"2926\" data-permalink=\"http:\/\/kenscourses.com\/tc101winter2015\/course-home-page-for-tc1014\/wsqs-tc1014\/wsq06-pick-a-number\/8147975983_360e685a22_k\/\" data-orig-file=\"https:\/\/i2.wp.com\/kenscourses.com\/tc101winter2015\/wp-content\/uploads\/2015\/02\/8147975983_360e685a22_k.jpg?fit=1363%2C2048\" data-orig-size=\"1363,2048\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"GitHub Office\" data-image-description=\"\" data-medium-file=\"https:\/\/i2.wp.com\/kenscourses.com\/tc101winter2015\/wp-content\/uploads\/2015\/02\/8147975983_360e685a22_k.jpg?fit=200%2C300\" data-large-file=\"https:\/\/i2.wp.com\/kenscourses.com\/tc101winter2015\/wp-content\/uploads\/2015\/02\/8147975983_360e685a22_k.jpg?fit=500%2C751\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">\n<\/div>\n<p>Write a program that picks a random integer in the range of 1 to 100.<\/p>\n<p>There are different ways to make that happen, you choose which one works best for you.<\/p>\n<div class=\"info-container\">\n<div class=\"info-text\">\n<div class=\"info-body s-rte\">\n<p>It then prompts the user for a guess of the value, with hints of \u2019too high\u2019 or \u2019too low\u2019 from the program.<\/p>\n<p>The program continues to run until the user guesses the integer. You could do something extra here including telling there user how many guesses they had to make to get the right answer.<\/p>\n<p>You might want to check that your program doesn\u2019t always use the same random number is chosen and you should also split your problem solving into parts. Perhaps only generate the random number and print that as a first step.<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!--more--><\/p>\n<h2><\/h2>\n<h2>Example Run<\/h2>\n<p>I have a number chosen between 1 and 100.<br \/>\nPlease guess a number between 1 and 100:\u00a0 50<br \/>\nI\u2019m sorry but 50 is too high, try again: 25<br \/>\nI\u2019m sorry but 25 is too low, try again: 42<br \/>\nYou got it! The right answer is indeed 42.<br \/>\nYou made 3 guesses to get the right number.<\/p>\n<h2>What to Submit<\/h2>\n<p>As usual, create a blog post explaining what you did, where you found resources (books, videos, web pages, friends) to help you solve this. Remember to put the tag #WSQ03 on your post so our blog hub picks that up.<\/p>\n<p>You should include your code either inline in the blog post (best option) and\/or a link to your actual code on Dropbox\/Google Drive\/GitHub.<\/p>\n<p>You may want to check how to get started on GitHub now, here is a good article to start with: <a title=\"GitHub For Beginners: Don't Get Scared, Get Started\" href=\"http:\/\/readwrite.com\/2013\/09\/30\/understanding-github-a-journey-for-beginners-part-1\">http:\/\/readwrite.com\/2013\/09\/30\/understanding-github-a-journey-for-beginners-part-1<\/a><\/p>\n<p>And of course, leave any questions here as well as asking those questions on Twitter with the hashtag #TC1014 so we all see your question posted there.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What to Do Write a program that picks a random integer in the range of 1 to 100. There are different ways to make that happen, you choose which one works best for you. It then prompts the user for a guess of the value, with hints of \u2019too high\u2019 or \u2019too low\u2019 from the &hellip; <a href=\"https:\/\/kenscourses.com\/tc1014winter2017\/instructor\/wsq-03-pick-a-number-week-04\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">WSQ 03 \u2013 Pick a Number (Week 04)<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":2926,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,24],"tags":[],"class_list":["post-36542","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-instructor","category-wsq"],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc1014winter2017\/wp-json\/wp\/v2\/posts\/36542","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kenscourses.com\/tc1014winter2017\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenscourses.com\/tc1014winter2017\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc1014winter2017\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc1014winter2017\/wp-json\/wp\/v2\/comments?post=36542"}],"version-history":[{"count":1,"href":"https:\/\/kenscourses.com\/tc1014winter2017\/wp-json\/wp\/v2\/posts\/36542\/revisions"}],"predecessor-version":[{"id":36543,"href":"https:\/\/kenscourses.com\/tc1014winter2017\/wp-json\/wp\/v2\/posts\/36542\/revisions\/36543"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc1014winter2017\/wp-json\/wp\/v2\/media?parent=36542"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc1014winter2017\/wp-json\/wp\/v2\/categories?post=36542"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc1014winter2017\/wp-json\/wp\/v2\/tags?post=36542"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}