Warning: The magic method Slickr_Flickr_Plugin::__wakeup() must have public visibility in /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php on line 152

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831
{"id":4395,"date":"2015-02-11T21:22:37","date_gmt":"2015-02-12T03:22:37","guid":{"rendered":"http:\/\/tc1014.withknown.com\/2015\/wsq06---pick-a-number"},"modified":"2015-02-12T17:59:17","modified_gmt":"2015-02-12T23:59:17","slug":"wsq06-pick-a-number-9","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101winter2015\/2015\/wsq06-pick-a-number-9\/","title":{"rendered":"WSQ06 – pick a number"},"content":{"rendered":"
\n

#TC1014<\/a> #WSQ06<\/a> #awesome<\/a><\/strong><\/p>\n

this time the program has to pick a number at random from 1 to 100 and ask the user to gues the number, after the user makes a guess the program will give hints if the number the user gave is too high or too low in relation with the number picked by the program.<\/strong><\/p>\n

for the program to choose a number at random you can use the random function of python:<\/strong><\/p>\n

import random<\/strong><\/p>\n

and give a variable for the value, if we want a number from 1 to 100 set the range (1,101) because the range goes from the first number to the number before the last.<\/strong><\/p>\n

import random<\/strong><\/p>\n

x = random.randrange(1,101)<\/strong><\/p>\n

with that you should get a random number between 1 and 100. now ask the user for an integer to continue with the program and open a “while” loop so the program doesn’t stop until the number from the user is the same as the random:<\/strong><\/p>\n

y = int(input(“number”))<\/strong><\/p>\n

while y != x:     ——- (“!=” means not equal to)<\/strong><\/p>\n

and to give the hints to help the user use if statements and ask for anothe number:<\/strong><\/p>\n

if y > x:<\/strong><\/p>\n

   print (“too high”)<\/strong><\/p>\n

   y = int(input(“again”))<\/strong><\/p>\n

make another for a number below the random. when the user hits the number tell the program to print it:<\/strong><\/p>\n

print (“correct it is “,y)<\/strong><\/p>\n

if you want to add a counter to know how many times you tried make a variable with 0 and do this inside the while loop:<\/strong><\/p>\n

z = 0<\/strong><\/p>\n

while y != x:<\/strong><\/p>\n

    z += 1<\/strong><\/p>\n

and tell the program to print the result at the end:<\/strong><\/p>\n

print (z)<\/strong><\/p>\n

my code is in github:<\/strong><\/p>\n

https:\/<\/wbr>\/<\/wbr>github.com\/<\/wbr>nazare52\/<\/wbr>progra\/<\/wbr>commit\/<\/wbr>2515ed92aae442c058c6c1c325ed6bbe2a24cb0d<\/a><\/strong><\/p>\n

this video helped me to understand loops in python:<\/strong><\/p>\n

https:\/<\/wbr>\/<\/wbr>www.youtube.com\/<\/wbr>watch?v=9AJ0uoxtdCQ<\/a><\/strong><\/p>\n

 question- how do I tell the program to run again after completing the condition of the while loop?<\/strong><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"

#TC1014 #WSQ06 #awesomethis time the program has to pick a number at random from 1 to 100 and ask the user to gues the number, after the user makes a guess the program will give hints if the number the user gave is too high or too low in relat… Continue reading →<\/span><\/a><\/p>\n","protected":false},"author":128,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3,25],"tags":[228,45,167],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts\/4395"}],"collection":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/users\/128"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/comments?post=4395"}],"version-history":[{"count":5,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts\/4395\/revisions"}],"predecessor-version":[{"id":7170,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts\/4395\/revisions\/7170"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/media?parent=4395"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/categories?post=4395"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/tags?post=4395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}