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":7796,"date":"2015-03-09T11:17:04","date_gmt":"2015-03-09T17:17:04","guid":{"rendered":"https:\/\/tc1014.withknown.com\/2015\/wsq09---factorial-calculator"},"modified":"2015-03-09T11:17:04","modified_gmt":"2015-03-09T17:17:04","slug":"wsq09-factorial-calculator-3","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101winter2015\/2015\/wsq09-factorial-calculator-3\/","title":{"rendered":"WSQ09 – factorial calculator"},"content":{"rendered":"
\n

this time the program has to calculate the factorial (n!) of a non-negative number given by the user.<\/strong><\/p>\n

first we have to understand what factorial is. it is the multiplication of all the numbers from 1 to n.<\/strong><\/p>\n

n!= 1x2x3x4x5x. . . . . xn!<\/strong><\/p>\n

now we could use the python function for factorial  math.factorial(n) but lets do math.<\/span><\/strong><\/p>\n

first ask the user for a positive integer and set the folowing variables:<\/span><\/strong><\/p>\n

n = int(input())<\/span><\/strong><\/p>\n

f = 0  – – – – this is a counter<\/span><\/strong><\/p>\n

c = 1   – – – – this will be the factorial product<\/span><\/strong><\/p>\n

now we can do this with a while or a for loop, for the while loop we could put it like this:<\/span><\/strong><\/p>\n

while f < n:<\/span><\/strong><\/p>\n

       f += 1<\/span><\/strong><\/p>\n

       c = c*f<\/span><\/strong><\/p>\n

and the for loop:<\/strong><\/span><\/span><\/p>\n

for t in n:<\/strong><\/span><\/span><\/p>\n

        f += 1<\/span><\/strong><\/p>\n

       c = c*f<\/span><\/strong><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"

this time the program has to calculate the factorial (n!) of a non-negative number given by the user.first we have to understand what factorial is. it is the multiplication of all the numbers from 1 to n.n!= 1x2x3x4x5x. . . . . xn!now we could… 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":[144],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts\/7796"}],"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=7796"}],"version-history":[{"count":2,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts\/7796\/revisions"}],"predecessor-version":[{"id":7975,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts\/7796\/revisions\/7975"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/media?parent=7796"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/categories?post=7796"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/tags?post=7796"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}