19th Feb 2013 - LPTHW - Learnings

  1. EX2 - "%" is modulus and not percentage. So its like X divided by J with Z remaining. So Z is the modulus. So if 4%3 is, 4 divided by 3 and the remainder left after that, which is 1. 
  2. EX2 - Order of Operation in Python follows - PEMDAS , which stands for Parentheses Exponents Multiplication Divison Addition Subtraction.
  3. EX4 - Always put space around operators, makes the code more legible to read and is the correct manner.
  4. EX5 - If a variable contains a string, using %r formatter instead of %d or %s puts the string under single quote while printing them.
  5. EX6 - The formatter %r is used only for deigging purpose and contains the raw data of the variable, the other two formatter %d and %s are used for displaying to the users.
  6. EX7 - Any code line greater than 80 characters in a single line in Python is not good code style.
  7. EX7 - If you put comma after a code line, the next code line is printed on the same line with a space in between the two.
  8. EX7 - The comments need not start with capital letters or should contain capital letters.
  9. EX8 - While using the formatter %r, if a string contains a single quote  in of the  the words like in "ain't" the python displays the entire string with double quotes as it is the most efficient way to display that string.
  10. EX9 - A variable may contain a string, which can be printed out with another string without using the formatter, by placing a comma after the string which is to be printed and typing the name of the variable.
  11. EX9 - By using three double-quotes like """ we can print as many number of lines as we want.
  12. EX10 - If \n and \t are used together like \n\t then the output is the same as using \t alone. 
  13. EX11- When to print the input raw, %r formatter to be used.
  14. EX11 - When the input from raw_input() needs to be displayed on the same line, then "," to be used after the print statement.