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":4770,"date":"2015-02-15T19:06:51","date_gmt":"2015-02-16T01:06:51","guid":{"rendered":"http:\/\/tc1014.withknown.com\/2015\/wsq07---sum-of-numbers"},"modified":"2015-02-15T19:06:51","modified_gmt":"2015-02-16T01:06:51","slug":"wsq07-sum-of-numbers-8","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101winter2015\/2015\/wsq07-sum-of-numbers-8\/","title":{"rendered":"WSQ07 – sum of numbers"},"content":{"rendered":"
\n

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

the program has to sum all the integers in range between two numbers given by the user. at first I did it with the range function but the teacher asked for a loop to make the operation so I did it like this.<\/strong><\/p>\n

ask for two integers, one low and one high but if the user enters the a lower number in the high number place the program wont work properly so I added a condition to correct the numbers:<\/strong><\/p>\n

x = low<\/strong><\/p>\n

y = high<\/strong><\/p>\n

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

    x,y = y,x<\/strong><\/p>\n

that will exchange the values between the x and y and so continue the program correctly. now to do the sum i added a variable with a value of 0 and used a while loop:<\/strong><\/p>\n

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

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

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

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

that will add x to z and rise x one number to keep the loop until x=y but will stop before the last number, if x=1 and y=5 then the operation would be 1+2+3+4 excluding the high number, to fix this I added a last operation at the end to print the sum the resulting z with the high number y:<\/strong><\/p>\n

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

and it’s done.<\/strong><\/p>\n

question – how do I tell the program to ask again for an integer if the user enters a string?<\/strong><\/p>\n

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

https:\/<\/wbr>\/<\/wbr>github.com\/<\/wbr>nazare52\/<\/wbr>progra\/<\/wbr>blob\/<\/wbr>master\/<\/wbr>wsq07.py<\/a><\/strong><\/p>\n

 <\/strong><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"

#WSQ07 #TC1014 #awesomethe program has to sum all the integers in range between two numbers given by the user. at first I did it with the range function but the teacher asked for a loop to make the operation so I did it like this.ask for two i… 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,169],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts\/4770"}],"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=4770"}],"version-history":[{"count":2,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts\/4770\/revisions"}],"predecessor-version":[{"id":7169,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts\/4770\/revisions\/7169"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/media?parent=4770"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/categories?post=4770"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/tags?post=4770"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}