Warning: The magic method Slickr_Flickr_Plugin::__wakeup() must have public visibility in /home/kenbauer/public_kenscourses/tc101fall2015/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/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/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/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/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/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/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/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/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/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/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/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/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/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/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/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831
{"id":26734,"date":"2015-11-22T18:00:00","date_gmt":"2015-11-23T00:00:00","guid":{"rendered":"http:\/\/kenscourses.com\/tc101fall2015\/?guid=1b4c20f20ec78922ebb7b868516f053b"},"modified":"2015-11-23T11:53:25","modified_gmt":"2015-11-23T17:53:25","slug":"mastery-7-python-conventions","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101fall2015\/2015\/mastery-7-python-conventions\/","title":{"rendered":"Mastery 8 – Python conventions"},"content":{"rendered":"

Here i will show you what are the python conventions.
First of all, in python the indentation does matter. Indentantion is the way that python recognize if a code block has ended. For example:
if (a < b):<\/span><\/span>
counter + =1<\/span><\/span>
print (counter)<\/span><\/span>
This is wrong because the IF has nothing inside it, instead it will always add 1+ to the counter because is at the same level as the IF. This is not C++ or JS where you can tell the program when your if ends with {}. The right way to do it is this:
if ( a < b):<\/span><\/span>
     counter += 1<\/span><\/span>
print(counter)<\/span><\/span>
Also here are some tips to give a standar python style to your code:<\/span><\/span><\/span><\/span>
-Just do one statement per line<\/span><\/span><\/span><\/span><\/b>
Please don\u00b4t do this:<\/span><\/span><\/span><\/span><\/span><\/span>
<\/span> <\/span><\/span><\/span><\/span><\/span><\/span> <\/span><\/span><\/span><\/span><\/b>
def ejercicio3(diccionario): return ((“Homework promedio:”, sum(diccionario[“homework”])\/len(diccionario[“homework” ])), (“Quizzes promedio:”, sum(diccionario[“quizzes”])\/len(diccionario[“quizzes”])), (“Tests promedio:”, sum(diccionario[“tests”])\/len(diccionario[“tests”])))<\/span><\/span><\/span><\/span>
Yes, this is a python program that actually works. As you can see it is very hard to read and you will make others to have a bad time trying to understand what you want to do. Don\u00b4t be a smart a** and put order to your code so that everyone can understand it. <\/span><\/span> <\/span><\/span><\/span><\/span>
-Keep spaces between variables if necessary, just to make it more readable<\/span><\/span><\/span><\/span><\/b>
-Build your functions on the top part of the code<\/span><\/span><\/span><\/span><\/b>
I think that this is clear, declare your functions first and call them below. Try to declare all the functions you can on the top part and write the main program after that, this will make your code easier to read because if someone wants to follow the executuion order of your code he\/she doesn\u00b4t have to look for a specific function on all the code; otherwise, he\/she will know where the functions are and you will save him\/her time.<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span> <\/span><\/span><\/span><\/span><\/b>
–<\/b>Keep your code simple<\/b><\/span><\/span><\/span><\/span><\/span>
Here is an example of the last point:<\/span><\/span><\/span><\/span>
a = input(“Write a number”))<\/span><\/span>
a = int(a)<\/span><\/span>
for i in range(0,50)<\/span><\/span>
     if i\/a % 0:<\/span><\/span>
          counter = counter + 1<\/span><\/span>
b = counter*2<\/span><\/span>
c = b+18 <\/span><\/span>
print (c)<\/span><\/span>
This code is really simple but it can be done in less words and space<\/span><\/span>, the proper way to do it is:<\/span><\/span><\/span><\/span>
a =  int (input(“Write a number” ))<\/span><\/span>
for i in range( 0 , 50 )<\/span><\/span>
     if (i\/a) % 0:<\/span><\/span>
          counter += 1<\/span><\/span>
print(counter*2+18)<\/span><\/span> <\/span><\/span><\/span><\/span><\/p>\n

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

Here i will show you what are the python conventions.
First of all, in python the indentation does matter. Indentantion is the way that python recognize if a code block has ended. For example:
if (a < b):<\/span><\/span>
counter + =1<\/span><\/span>
print (counter)<\/span><\/span>
This is wrong because the IF has nothing inside it, instead it will always add 1+ to the counter because is at the same level as the IF. This is not C++ or JS where you can tell the program when your if ends with {}. The right way to do it is this:
if ( a < b):<\/span><\/span>
     counter += 1<\/span><\/span>
print(counter)<\/span><\/span>
Also here are some tips to give a standar python style to your code:<\/span><\/span><\/span><\/span>
-Just do one statement per line<\/span><\/span><\/span><\/span><\/b>
Please don´t do this:<\/span><\/span><\/span><\/span><\/span><\/span>
<\/span> <\/span><\/span><\/span><\/span><\/span><\/span> <\/span><\/span><\/span><\/span><\/b>
def ejercicio3(diccionario): return ((“Homework promedio:”, sum(diccionario[“homework”])\/len(diccionario[“homework” ])), (“Quizzes promedio:”, sum(diccionario[“quizzes”])\/len(diccionario[“quizzes”])), (“Tests promedio:”, sum(diccionario[“tests”])\/len(diccionario[“tests”])))<\/span><\/span><\/span><\/span>
Yes, this is a python program that actually works. As you can see it is very hard to read and you will make others to have a bad time trying to understand what you want to do. Don´t be a smart a** and put order to your code so that everyone can understand it. <\/span><\/span> <\/span><\/span><\/span><\/span>
-Keep spaces between variables if necessary, just to make it more readable<\/span><\/span><\/span><\/span><\/b>
-Build your functions on the top part of the code<\/span><\/span><\/span><\/span><\/b>
I think that this is clear, declare your functions first and call them below. Try to declare all the functions you can on the top part and write the main program after that, this will make your code easier to read because if someone wants to follow the executuion order of your code he\/she doesn´t have to look for a specific function on all the code; otherwise, he\/she will know where the functions are and you will save him\/her time.<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span> <\/span><\/span><\/span><\/span><\/b>
–<\/b>Keep your code simple<\/b><\/span><\/span><\/span><\/span><\/span>
Here is an example of the last point:<\/span><\/span><\/span><\/span>
a = input(“Write a number”))<\/span><\/span>
a = int(a)<\/span><\/span>
for i in range(0,50)<\/span><\/span>
     if i\/a % 0:<\/span><\/span>
          counter = counter + 1<\/span><\/span>
b = counter*2<\/span><\/span>
c = b+18 <\/span><\/span>
print (c)<\/span><\/span>
This code is really simple but it can be done in less words and space<\/span><\/span>, the proper way to do it is:<\/span><\/span><\/span><\/span>
a =  int (input(“Write a number” ))<\/span><\/span>
for i in range( 0 , 50 )<\/span><\/span>
     if (i\/a) % 0:<\/span><\/span>
          counter += 1<\/span><\/span>
print(counter*2+18)<\/span><\/span> <\/span><\/span><\/span><\/span><\/p>\n

 <\/span><\/span><\/span><\/span> <\/p>\n","protected":false},"author":198,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3],"tags":[647,178,855,628],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/26734"}],"collection":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/users\/198"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/comments?post=26734"}],"version-history":[{"count":3,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/26734\/revisions"}],"predecessor-version":[{"id":26995,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/26734\/revisions\/26995"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/media?parent=26734"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/categories?post=26734"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/tags?post=26734"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}